Skip to content

Commit

Permalink
adds tests for deleting diles after prediction
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedhosny committed Aug 29, 2018
1 parent 62f2122 commit 136bb53
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions framework/modelhubapi_tests/restapi_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,13 @@ def test_predict_by_post_returns_error_on_unsupported_file_type(self):
self.assertIn("error", result)
self.assertIn("Incorrect file type.", result["error"])



def test_working_folder_empty_after_predict_by_post(self):
response = self._post_predict_request_on_sample_image("testimage_ramp_4x2.png")
self.assertEqual(200, response.status_code)
self.assertEqual(len(os.listdir(self.temp_workdir) ), 0)


# TODO this is not so nice yet, test should not require a download from the inet
# should probably use a mock server for this
def test_predict_by_url_returns_expected_mock_prediction(self):
Expand All @@ -145,7 +151,13 @@ def test_predict_by_url_returns_error_on_unsupported_file_type(self):
result = json.loads(response.get_data())
self.assertIn("error", result)
self.assertIn("Incorrect file type.", result["error"])



def test_working_folder_empty_after_predict_by_url(self):
response = self.client.get("/api/predict?fileurl=https://raw.githubusercontent.com/modelhub-ai/modelhub-docker/master/framework/modelhublib_tests/testdata/testimage_ramp_4x2.png")
self.assertEqual(200, response.status_code)
self.assertEqual(len(os.listdir(self.temp_workdir) ), 0)


def test_predict_sample_returns_expected_mock_prediction(self):
response = self.client.get("/api/predict_sample?filename=testimage_ramp_4x2.png")
Expand Down

0 comments on commit 136bb53

Please sign in to comment.