def test_0013(self): """mock_api.get(): Passing a trigger header triggers a DataONEException""" mock_get.init(settings.MN_RESPONSES_BASE_URL) self.assertRaises(d1_common.types.exceptions.NotAuthorized, self.client.get, 'test_pid', vendorSpecific={'trigger': '401'})
def test_0011(self): """mock_api.get() returns the same content each time for a given PID""" mock_get.init(settings.MN_RESPONSES_BASE_URL) obj_1a_str = self.client.get('test_pid_1').content obj_2a_str = self.client.get('test_pid_2').content obj_1b_str = self.client.get('test_pid_1').content obj_2b_str = self.client.get('test_pid_2').content self.assertEqual(obj_1a_str, obj_1b_str) self.assertEqual(obj_2a_str, obj_2b_str)
def test_0012(self): """mock_api.get() returns 1024 bytes""" mock_get.init(settings.MN_RESPONSES_BASE_URL) obj_str = self.client.get('test_pid_1').content self.assertEqual(len(obj_str), 1024)
def test_0010(self): """mock_api.get() returns a Requests Response object""" mock_get.init(settings.MN_RESPONSES_BASE_URL) self.assertIsInstance(self.client.get('test_pid_1'), requests.Response)
def setUp(self): mock_get.init(shared_settings.MN_RESPONSES_URL) mock_post.init(shared_settings.MN_RESPONSES_URL)