Skip to content

Commit

Permalink
Merge pull request #22 from johandahlberg/no_error_on_next
Browse files Browse the repository at this point in the history
Do not raise error when there is no runfolder
  • Loading branch information
johandahlberg authored Sep 13, 2018
2 parents f9c8f03 + 4f45bfc commit 460c231
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion runfolder/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ def get(self):
runfolder_info = self.runfolder_svc.next_runfolder()
if runfolder_info:
self.append_runfolder_link(runfolder_info)
self.write_object(runfolder_info)
self.write_object(runfolder_info)
else:
self.set_status(204, reason="No ready runfolder available.")
self.write(dict())


class PickupAvailableRunfolderHandler(BaseRunfolderHandler):
Expand Down
4 changes: 4 additions & 0 deletions runfolder_tests/integration/rest_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ def test_next_runfolder(self):
# Remove the path created, so it does not interfere with other tests
shutil.rmtree(path)

def test_call_next_without_ready_runfolder(self):
# Status code 204 is no content.
response = self.get("./runfolders/next", expect=204)

def _exists(self, path):
resp = self.get("./runfolders")
runfolders = resp.body_obj["runfolders"]
Expand Down

0 comments on commit 460c231

Please sign in to comment.