Skip to content

Commit

Permalink
Fix tests for postgres deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
aristizabal95 committed Dec 18, 2024
1 parent f5bd343 commit 6bdcfdf
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions server/benchmark/tests/test_.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,10 @@ def test_generic_get_benchmark_list(self):

@parameterized.expand([
({"name": "bmk2"}, 1),
({"name": "string", "owner": 3}, 1),
({"name": "bmk2", "owner": None}, 1), # id assigned dynamically
({"name": "nonexistent"}, 0),
({"is_valid": True}, 2),
({"data_preparation_mlcube": 2}, 1),
({"data_preparation_mlcube": None}, 1), # id assigned dinamically
])
def test_get_with_query_params(self, query_dict, expected_num_results):
# Arrange
Expand All @@ -295,11 +295,17 @@ def test_get_with_query_params(self, query_dict, expected_num_results):
self.ref_model["id"], self.prep["id"], self.eval["id"], name="bmk2"
)
benchmark = self.create_benchmark(benchmark).data
if 'owner' in query_dict:
query_dict['owner'] = benchmark['owner']
if 'data_preparation_mlcube' in query_dict:
query_dict['data_preparation_mlcube'] = self.prep['id']
query_str = "&".join([f"{k}={v}" for k, v in query_dict.items()])

# Act
query_url = self.url + f"?{query_str}"
response = self.client.get(query_url)
print(query_url, response.status_code, response.data['results'])
print("Unfiltered Query:", self.client.get(self.url).data['results'])

# Assert
self.assertEqual(response.status_code, status.HTTP_200_OK)
Expand Down

0 comments on commit 6bdcfdf

Please sign in to comment.