-
Notifications
You must be signed in to change notification settings - Fork 16
added new unit tests for the get method of handler "BarcodeUtilHandler" #159
Changes from 7 commits
c0ffe39
2a711b7
76be6f7
cb025b5
754dff6
85d53b3
0c24984
d515e52
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -201,6 +201,9 @@ def get(self): | |
project_names = db.getProjectNames() | ||
|
||
# barcode exists get general info | ||
# TODO (Stefan Janssen): check spelling of "received", i.e. tests in | ||
# the template check for 'Recieved'. I think the logic is broken due | ||
# to that. | ||
if barcode_details['status'] is None: | ||
barcode_details['status'] = 'Received' | ||
if barcode_details['biomass_remaining'] is None: | ||
|
@@ -213,6 +216,8 @@ def get(self): | |
if (barcode_details['obsolete'] == "Y"): | ||
# the barcode is obsolete | ||
div_id = "obsolete" | ||
# TODO: Stefan: why is that set here, as far as I see, this | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I concur |
||
# message will in all cases be overwritten! | ||
message = "Barcode is Obsolete" | ||
# get project info for div | ||
ag_details = [] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,9 +25,10 @@ def test_get(self): | |
|
||
# test successful query | ||
response = self.get('/update_ebi/') | ||
self.assertEqual(response.code, 200) | ||
self.assertIn('Successfully updated barcodes in database', | ||
response.body) | ||
self.assertIn(response.code, [200, 599]) # either success, or time out | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would it make sense to have it retry on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have the feeling that Travis imposes some limitations on the time-out length, because it always returns fine, i.e. with 200, when running this test on my local machine. I don't want to spend too much effort here to figure out how to make this happen within Travis. But any recommendations are welcome! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, sounds good. On closer inspection, it could also be the case that EBI is throttling travis as well. I don't think there is an easy solution here. |
||
if response.code == 200: | ||
self.assertIn('Successfully updated barcodes in database', | ||
response.body) | ||
|
||
# TODO: I cannot see how I can raise an Exception, since there are no | ||
# input arguments necessary for the get() method | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the DB, it is written
"Received"
, but in the template it is used like{% for bstatus in ['Recieved', ''] %} {% if bstatus == barcode_info['status'] %}
So I don't see how that condition can ever be satisfied.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea... that's not good.