Skip to content

Commit

Permalink
Request application/json when getting status
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Graves committed Jul 14, 2016
1 parent 7aebef4 commit f20f8e4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion slingshot/app.py
Expand Up @@ -26,7 +26,8 @@ def url(self, url):
self._url = url.rstrip('/')

def status(self, layer):
r = self.session.get('{}/{}'.format(self.url, layer))
r = self.session.get('{}/{}'.format(self.url, layer),
headers={'Accept': 'application/json'})
if r.status_code == 404:
return None
r.raise_for_status()
Expand Down
7 changes: 7 additions & 0 deletions tests/test_app.py
Expand Up @@ -55,6 +55,13 @@ def test_tmp_archive_removes_archive(layer):
assert not os.path.exists(arxiv)


def test_kepler_requests_json_for_status(kepler):
k = Kepler('mock://example.com/completed/')
k.status('47458e22-8e50-5b43-ac80-b662a1077af1')
assert kepler.request_history[0].headers.get('Accept') == \
'application/json'


def test_kepler_returns_status(kepler):
k = Kepler('mock://example.com/completed/')
assert k.status('47458e22-8e50-5b43-ac80-b662a1077af1') == 'COMPLETED'
Expand Down

0 comments on commit f20f8e4

Please sign in to comment.