def test_get_or_create_if_account_sid_with_exception(self, twilio_account): twilio_account.return_value = self.mock_account() Account.get_or_create(account_sid='test') self.assertEqual(1, Account.objects.all().count()) self.assertEqual('test', Account.objects.first().sid)
def test_get_or_create_if_account_sid_no_exception(self): account_1 = mommy.make(Account, sid='test') account_2 = Account.get_or_create(account_sid='test') self.assertEqual(1, Account.objects.all().count()) self.assertEqual(account_1, account_2)
def test_get_or_create_if_not_account_sid_with_exception(self): Account.get_or_create(account=self.mock_account()) self.assertEqual(1, Account.objects.all().count()) self.assertEqual('test', Account.objects.first().sid)
def test_get_status_choice_status_display_equal_choice(self): self.assertEqual(0, Account.get_status_choice('active'))
def test_get_status_choice_status_display_not_equal_choice(self): self.assertEqual(None, Account.get_status_choice('test'))
def test_get_account_type_choice_account_type_display_equal_choice(self): self.assertEqual(0, Account.get_account_type_choice('Trial'))
def test_get_account_type_choice_account_type_display_not_equal_choice( self): self.assertEqual(None, Account.get_account_type_choice('test'))