From b9fac875c47af88146b9c7a2ed9c68fe13479c1b Mon Sep 17 00:00:00 2001 From: Saleem Ansari Date: Thu, 29 Mar 2018 17:53:43 +0530 Subject: [PATCH] Add test with valid input for graph import --- test/test_rest_api.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/test_rest_api.py b/test/test_rest_api.py index 1d33e4ab..2720832a 100644 --- a/test/test_rest_api.py +++ b/test/test_rest_api.py @@ -115,6 +115,22 @@ def test_selective_ingest_nonempty(self): assert response.status_code == 400 assert 'Invalid keys found in input:' in data['message'] + def test_selective_ingest_valid(self): + """Add test for selective ingest API with wrong input.""" + input_data = { + 'package_list': [{"version": "0.4.59", + "name": "access_points", + "ecosystem": "pypi" + }], + 'select_ingest': []} + response = self.app.post('/api/v1/selective_ingest', + data=json.dumps(input_data), + headers={'Content-Type': 'application/json'}) + data = json.loads(response.get_data()) + logger.info(data) + assert response.status_code == 200 + assert 'The import finished successfully!' in data['message'] + if __name__ == '__main__': unittest.main()