def test_get_default_account(self, account_retrieve_mock): account_retrieve_mock.return_value = FAKE_ACCOUNT Account.get_default_account() account_retrieve_mock.assert_called_once_with( api_key=settings.STRIPE_SECRET_KEY)
def test_get_default_account(self, file_retrieve_mock, account_retrieve_mock): account_retrieve_mock.return_value = deepcopy(FAKE_ACCOUNT) account = Account.get_default_account() account_retrieve_mock.assert_called_once_with( api_key=djstripe_settings.STRIPE_SECRET_KEY ) self.assertGreater(len(account.business_profile), 0) self.assertGreater(len(account.settings), 0) self.assertEqual(account.branding_icon.id, FAKE_FILEUPLOAD_ICON["id"]) self.assertEqual(account.branding_logo.id, FAKE_FILEUPLOAD_LOGO["id"]) self.assertEqual(account.settings["branding"]["icon"], account.branding_icon.id) self.assertEqual(account.settings["branding"]["logo"], account.branding_logo.id) self.assertNotEqual(account.branding_logo.id, account.branding_icon.id) self.assert_fks(account, expected_blank_fks={}) self.assertEqual(account.business_url, "https://djstripe.com") account.business_profile = None self.assertEqual(account.business_url, "")
def test_get_default_account(self, fileupload_retrieve_mock, account_retrieve_mock): account_retrieve_mock.return_value = deepcopy(FAKE_ACCOUNT) account = Account.get_default_account() account_retrieve_mock.assert_called_once_with( api_key=STRIPE_SECRET_KEY) self.assertGreater(len(account.business_profile), 0) self.assertGreater(len(account.settings), 0) self.assertEqual(account.branding_icon.id, FAKE_FILEUPLOAD_ICON["id"]) self.assertEqual(account.branding_logo.id, FAKE_FILEUPLOAD_LOGO["id"]) self.assertEqual(account.settings["branding"]["icon"], account.branding_icon.id) self.assertEqual(account.settings["branding"]["logo"], account.branding_logo.id) with self.assertWarns(DeprecationWarning): self.assertEqual(account.business_logo.id, account.branding_icon.id) self.assertNotEqual(account.branding_logo.id, account.branding_icon.id) self.assert_fks(account, expected_blank_fks={})
def test_account_str_restricted_key(self, account_retrieve_mock): """ Test that we do not attempt to retrieve account ID with restricted keys. """ assert djstripe_settings.STRIPE_SECRET_KEY == "rk_test_blah" account = Account.get_default_account() assert account is None account_retrieve_mock.assert_not_called()
def test_get_default_account(self, fileupload_retrieve_mock, account_retrieve_mock): account_retrieve_mock.return_value = FAKE_ACCOUNT account = Account.get_default_account() account_retrieve_mock.assert_called_once_with( api_key=STRIPE_SECRET_KEY) self.assert_fks(account, expected_blank_fks={})
def test_get_default_account_null_logo(self, fileupload_retrieve_mock, account_retrieve_mock): fake_account = deepcopy(FAKE_ACCOUNT) fake_account["business_logo"] = None account_retrieve_mock.return_value = fake_account account = Account.get_default_account() account_retrieve_mock.assert_called_once_with( api_key=STRIPE_SECRET_KEY) self.assert_fks(account, expected_blank_fks={"djstripe.Account.business_logo"})
def test_account_str( fileupload_retrieve_mock, account_retrieve_mock, business_profile_update, settings_dashboard_update, expected_account_str, ): fake_account = deepcopy(FAKE_ACCOUNT) fake_account["business_profile"].update(business_profile_update) fake_account["settings"]["dashboard"].update(settings_dashboard_update) account_retrieve_mock.return_value = fake_account account = Account.get_default_account() assert str(account) == expected_account_str
def test_get_default_account_null_logo( self, fileupload_retrieve_mock, account_retrieve_mock ): fake_account = deepcopy(FAKE_ACCOUNT) fake_account["settings"]["branding"]["icon"] = None fake_account["settings"]["branding"]["logo"] = None account_retrieve_mock.return_value = fake_account account = Account.get_default_account() account_retrieve_mock.assert_called_once_with( api_key=djstripe_settings.STRIPE_SECRET_KEY ) self.assert_fks( account, expected_blank_fks={ "djstripe.Account.branding_logo", "djstripe.Account.branding_icon", }, )
def test_get_default_account(self, account_retrieve_mock): account_retrieve_mock.return_value = FAKE_ACCOUNT Account.get_default_account() account_retrieve_mock.assert_called_once_with(api_key=settings.STRIPE_SECRET_KEY)