Skip to content

Commit

Permalink
Merge pull request #141 from tuxdna/rest_api_tests
Browse files Browse the repository at this point in the history
Add test with valid input for graph import
  • Loading branch information
tisnik authored Mar 29, 2018
2 parents 54b5cf5 + b9fac87 commit 3d9f946
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/test_rest_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit 3d9f946

Please sign in to comment.