Skip to content

Commit

Permalink
Merge pull request #266 from Glutexo/query_by_insights_id_tests
Browse files Browse the repository at this point in the history
Test query hosts by invalid insights ID
  • Loading branch information
dehort authored May 21, 2019
2 parents e493e33 + fd44fec commit 959db09
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1489,8 +1489,11 @@ def test_query_using_non_existent_id(self):

class QueryByInsightsIdTestCase(PreCreatedHostsBaseTestCase):

def _test_url(self, query_value):
return HOST_URL + "?insights_id=" + query_value

def _base_query_test(self, query_value, expected_number_of_hosts):
test_url = HOST_URL + "?insights_id=" + query_value
test_url = self._test_url(query_value)

response = self.get(test_url)

Expand All @@ -1507,6 +1510,10 @@ def test_query_with_no_matching_insights_id(self):
uuid_that_does_not_exist_in_db = generate_uuid()
self._base_query_test(uuid_that_does_not_exist_in_db, 0)

def test_query_with_invalid_insights_id(self):
test_url = self._test_url("notauuid")
self.get(test_url, 400)

def test_query_with_maching_insights_id_and_branch_id(self):
valid_insights_id = self.added_hosts[0].insights_id

Expand Down

0 comments on commit 959db09

Please sign in to comment.