Standard errors#25
Conversation
Add a couple more tests for error cases. Add coverage calculation to test runs. Update readme with error structure details
| self.assertTrue(True) | ||
| return |
There was a problem hiding this comment.
Same effect as skipTest but without giving a misleading s in the test output
| python -m spec.validate && | ||
| # spec stored query tests | ||
| python -m unittest discover spec/test && | ||
| coverage run --parallel-mode -m unittest discover spec/test && |
There was a problem hiding this comment.
Add in coverage calculation
| "AT1G01050__AT1G01060__AraNetv2-LC_lit-curated-ppi__2.7", | ||
| "AT1G01080__AT1G01090__AraNetv2-LC_lit-curated-ppi__2.8" | ||
| ] | ||
| "-": { |
There was a problem hiding this comment.
small reformat, big diff!
| @@ -0,0 +1,64 @@ | |||
| name: ncbi_taxon | |||
There was a problem hiding this comment.
Next four files are just to check that the validator picks up duplicate file names.
| try: | ||
| data = validate_schema(path, schema_type) | ||
| # Check for any duplicate schema names | ||
| name = data['name'] | ||
| if name in names: | ||
| raise ValueError(f"Duplicate queries named '{name}'") | ||
| else: | ||
| names.add(name) | ||
|
|
||
| except Exception as err: | ||
| print(f"✕ {path} failed validation") | ||
| print(err) | ||
| err_count += 1 |
There was a problem hiding this comment.
validate all files in the dir, don't quit after the first failure
| return | ||
|
|
||
|
|
||
| def validate_all_by_type(validation_base_dir=None): |
There was a problem hiding this comment.
new method that pulls together all the validation routines
|
|
||
| 'error': { | ||
| 'message': <text explanation of error>, | ||
| 'status': <HTTP error code>, |
There was a problem hiding this comment.
It doesn't seem like we need status here if it is always in the header.
There was a problem hiding this comment.
Yeah, that was my thought too - the only reason I left it in is that it was in several of the error structures. I'm happy to remove it globally.
|
A couple small comments above, otherwise looks good |
Refactor test_djornl tests to put all results in the results.json file. Update djornl_fetch_* queries to ensure that empty arrays cannot be entered as query params
| self.assertEqual(resp['arangodb_status'], 'connected_authorized') | ||
| self.assertTrue(resp['commit_hash']) | ||
| self.assertTrue(resp['repo_url']) | ||
| resp_json = requests.get(URL + '/').json() |
There was a problem hiding this comment.
Consistent naming for responses -- if it is a response object, call it resp; if it is the deJSONified response body, call it resp_json.
| } | ||
| ) | ||
|
|
||
| resp = requests.get(f"{API_URL}/data_sources/{name}") |
There was a problem hiding this comment.
repeated test removed
Standardised error responses from the API.
Also made misc fixes and added tests for various pieces of untested code.
Closes #14