Skip to content

Commit

Permalink
Merge pull request #35 from kittdotech/test-end-to-end
Browse files Browse the repository at this point in the history
[publish][s #34]: Finalization request in POST
  • Loading branch information
zelima committed Nov 17, 2016
2 parents 227d6cc + 634fed3 commit 81ca097
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dpm/client/do_publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def publish(ctx, username, password, server, debug):
'Content-Length': '%d' % filestream.len})

echo('Finalizing ... ', nl=False)
response = request('GET',
response = request('POST',
'%s/api/package/%s/%s/finalize' % (
server, username, dp.descriptor['name']),
headers={'Authorization': 'Bearer %s' % token})
Expand Down
4 changes: 2 additions & 2 deletions tests/test_publish_success.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def test_publish_success(self):
status=200)
# AND registry server successfully finalizes upload
responses.add(
responses.GET, 'https://example.com/api/package/user/some-datapackage/finalize',
responses.POST, 'https://example.com/api/package/user/some-datapackage/finalize',
json={'message': 'OK'},
status=200)

Expand Down Expand Up @@ -100,7 +100,7 @@ def test_publish_success(self):
# PUT README to S3
('PUT', 'https://s3.fake/put_here', ''),
# GET finalize upload
('GET', 'https://example.com/api/package/user/some-datapackage/finalize', '')])
('POST', 'https://example.com/api/package/user/some-datapackage/finalize', '')])
# AND PUT request should contain serialized datapackage metadata
self.assertEqual(
responses.calls[1].request.body.decode(), self.valid_dp.to_json())
Expand Down
4 changes: 2 additions & 2 deletions tests/test_readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ def test_readme_sucess_for_multiple_readme(self):
status=200)
# AND registry server successfully finalizes upload
responses.add(
responses.GET, 'https://example.com/api/package/user/some-datapackage/finalize',
responses.POST, 'https://example.com/api/package/user/some-datapackage/finalize',
json={'message': 'OK'},
status=200)
# WHEN `dpm publish` is invoked
result = self.invoke(cli, ['publish', '--publisher', 'testpub'])

self.assertRegexpMatches(result.output, 'publish ok')
# Checking README uploading first match
self.assertNotIn('Publishing Package without README', result.output)
self.assertIn('Uploading README.txt', result.output)

0 comments on commit 81ca097

Please sign in to comment.