def test_submit_sample_fail_unavailable_no_msg(self, mock_get):
     '''
     Tests Metadefender._submit_sample()'s handling of a submission that fails due to
     a 500 error and where no message is returned
     '''
     print('Running test_submit_sample_fail_unavailable_no_msg')
     submit_resp = Metadefender._submit_sample(RANDOM_INPUT_FILES[1], 'scan_url', 'user_agent')
     self.assertEquals(submit_resp['status_code'], 500)
     self.assertEquals(submit_resp['error'], Metadefender.MD_HTTP_ERR_CODES[500])
     self.assertEquals(submit_resp['scan_id'], None)
 def test_submit_sample_fail_unavailable(self, mock_get):
     '''
     Tests Metadefender._submit_sample()'s handling of a submission that fails due to
     a 500 error
     '''
     print('Running test_submit_sample_fail_unavailable')
     submit_resp = Metadefender._submit_sample(RANDOM_INPUT_FILES[1], 'scan_url', 'user_agent')
     self.assertEquals(submit_resp['status_code'], 500)
     self.assertEquals(submit_resp['error'], MSG_SERVER_UNAVAILABLE)
     self.assertEquals(submit_resp['scan_id'], None)
 def test_submit_sample_success(self, mock_get):
     '''
     Tests Metadefender._submit_sample()'s handling of a successful response from
     the server
     '''
     print('Running test_submit_sample_success')
     submit_resp = Metadefender._submit_sample(RANDOM_INPUT_FILES[0], 'scan_url', 'user_agent')
     self.assertEquals(submit_resp['status_code'], 200)
     self.assertEquals(submit_resp['error'], None)
     self.assertEquals(submit_resp['scan_id'], generate_scan_id(RANDOM_INPUT_FILES[0]))
Beispiel #4
0
 def test_submit_sample_fail_unavailable(self, mock_get):
     '''
     Tests Metadefender._submit_sample()'s handling of a submission that fails due to
     a 500 error
     '''
     print('Running test_submit_sample_fail_unavailable')
     submit_resp = Metadefender._submit_sample(RANDOM_INPUT_FILES[1],
                                               'scan_url', 'user_agent')
     self.assertEquals(submit_resp['status_code'], 500)
     self.assertEquals(submit_resp['error'], MSG_SERVER_UNAVAILABLE)
     self.assertEquals(submit_resp['scan_id'], None)
Beispiel #5
0
 def test_submit_sample_fail_unavailable_no_msg(self, mock_get):
     '''
     Tests Metadefender._submit_sample()'s handling of a submission that fails due to
     a 500 error and where no message is returned
     '''
     print('Running test_submit_sample_fail_unavailable_no_msg')
     submit_resp = Metadefender._submit_sample(RANDOM_INPUT_FILES[1],
                                               'scan_url', 'user_agent')
     self.assertEquals(submit_resp['status_code'], 500)
     self.assertEquals(submit_resp['error'],
                       Metadefender.MD_HTTP_ERR_CODES[500])
     self.assertEquals(submit_resp['scan_id'], None)
Beispiel #6
0
 def test_submit_sample_success(self, mock_get):
     '''
     Tests Metadefender._submit_sample()'s handling of a successful response from
     the server
     '''
     print('Running test_submit_sample_success')
     submit_resp = Metadefender._submit_sample(RANDOM_INPUT_FILES[0],
                                               'scan_url', 'user_agent')
     self.assertEquals(submit_resp['status_code'], 200)
     self.assertEquals(submit_resp['error'], None)
     self.assertEquals(submit_resp['scan_id'],
                       generate_scan_id(RANDOM_INPUT_FILES[0]))