Skip to content

Commit

Permalink
Add spec for backups#archive
Browse files Browse the repository at this point in the history
  • Loading branch information
aurelien-reeves-scalingo committed Dec 22, 2022
1 parent 2b2cac1 commit 8d462e8
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 1 deletion.
3 changes: 2 additions & 1 deletion samples/regional_database/backups/_meta.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"addon_id": "ad-5ed10967884fef000f5e4fff"
"addon_id": "ad-5ed10967884fef000f5e4fff",
"backup_id": "5bb95a904ffb096e9a2831b8"
}
24 changes: 24 additions & 0 deletions samples/regional_database/backups/archive-200.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"path": "/databases/ad-5ed10967884fef000f5e4fff/backups/5bb95a904ffb096e9a2831b8/archive",
"method": "get",
"request": {
"headers": {
"Authorization": "Bearer the-bearer-token"
}
},
"response": {
"status": 200,
"headers": {
"Date": "Fri, 29 May 2020 13:08:59 GMT",
"Etag": "W/\"a9504bb2f6f87c65ff68074ae787831e\"",
"Content-Type": "application/json; charset=utf-8",
"Transfer-Encoding": "chunked",
"Connection": "keep-alive",
"Cache-Control": "max-age=0, private, must-revalidate",
"Referrer-Policy": "strict-origin-when-cross-origin"
},
"json_body": {
"download_url": "https://regional-database.scalingo.test/databases/ad-5ed10967884fef000f5e4fff/backups/5bb95a904ffb096e9a2831b8/download?token=token1234"
}
}
}
24 changes: 24 additions & 0 deletions samples/regional_database/backups/archive-400.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"path": "/databases/ad-5ed10967884fef000f5e4fff/backups/5bb95a904ffb096e9a2831b8/archive",
"method": "get",
"request": {
"headers": {
"Authorization": "Bearer the-bearer-token"
}
},
"response": {
"status": 400,
"headers": {
"Date": "Fri, 29 May 2020 13:08:59 GMT",
"Etag": "W/\"a9504bb2f6f87c65ff68074ae787831e\"",
"Content-Type": "application/json; charset=utf-8",
"Transfer-Encoding": "chunked",
"Connection": "keep-alive",
"Cache-Control": "max-age=0, private, must-revalidate",
"Referrer-Policy": "strict-origin-when-cross-origin"
},
"json_body": {
"error": "unauthorized"
}
}
}
17 changes: 17 additions & 0 deletions spec/scalingo/regional_database/backups_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,21 @@
it_behaves_like "a client error"
end
end

describe_method "archive" do
context "success" do
let(:arguments) { [meta[:addon_id], meta[:backup_id]] }
let(:stub_pattern) { "archive-200" }
let(:expected_keys) { %i[download_url] }

it_behaves_like "a singular object response"
end

context "failure" do
let(:arguments) { [meta[:addon_id], meta[:backup_id]] }
let(:stub_pattern) { "archive-400" }

it_behaves_like "a client error"
end
end
end

0 comments on commit 8d462e8

Please sign in to comment.