Commit c5cb39cc authored by Kenzo-Hugo Hillion's avatar Kenzo-Hugo Hillion
Browse files

fix tests and flake8

parent 118d26dc
Pipeline #14173 passed with stages
in 1 minute and 41 seconds
......@@ -60,7 +60,7 @@ class TestOperationsBulkViewSet(APITestCase):
}
self.function_api.put(data, function.function_id)
self.assertDictEqual(self.function_api.get(function.function_id), data)
def test_update_existing_functions(self):
data = [
{
......
......@@ -49,8 +49,11 @@ class BaseAPI(object):
response.raise_for_status()
return response.json()
def put(self, entry_id, data):
full_url = urljoin(self.url, entry_id)
def put(self, data, entry_id=None):
if entry_id:
full_url = urljoin(self.url, entry_id)
else:
full_url = self.url
response = self.session.put(f"{full_url}/", json=data)
response.raise_for_status()
return response.json()
......@@ -79,7 +79,7 @@ class ImportIGCGenes(object):
try:
gene_id = clean_gene_dict['gene_id']
self.metagenedb_gene_api.get(gene_id) # Try to get obj to check if it exists
self.metagenedb_gene_api.put(gene_id, clean_gene_dict)
self.metagenedb_gene_api.put(clean_gene_dict, entry_id=gene_id)
except HTTPError:
self.metagenedb_gene_api.post(clean_gene_dict)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment