def test_get_callback_function_import_error(self): with self.assertRaises(ImportError): get_callback_function("DJSTRIPE_TEST_CALLBACK")
def test_get_callback_function_with_valid_func_callable(self): func = get_callback_function("DJSTRIPE_TEST_CALLBACK") self.assertEqual("ok", func())
def test_get_callback_function_with_valid_string_callable( self, import_string_mock): func = get_callback_function("DJSTRIPE_TEST_CALLBACK") self.assertEqual("ok", func()) import_string_mock.assert_called_with('foo.valid_callback')
def test_get_callback_function_with_non_callable_string( self, import_string_mock): with self.assertRaises(ImproperlyConfigured): get_callback_function("DJSTRIPE_TEST_CALLBACK") import_string_mock.assert_called_with('foo.invalid_callback')
def test_get_callback_function_(self): with self.assertRaises(ImportError): get_callback_function("DJSTRIPE_TEST_CALLBACK")
def test_get_callback_function_with_non_callable_string(self, import_string_mock): with self.assertRaises(ImproperlyConfigured): get_callback_function("DJSTRIPE_TEST_CALLBACK") import_string_mock.assert_called_with('foo.invalid_callback')
def test_get_callback_function_with_valid_string_callable(self, import_string_mock): func = get_callback_function("DJSTRIPE_TEST_CALLBACK") self.assertEqual("ok", func()) import_string_mock.assert_called_with('foo.valid_callback')