def testAsDict(self): object = CardNumber("5155901222280001", "customer_21081826") self.assertDictEqual( {"card_number": "5155901222280001", "customer_id": "customer_21081826"}, object.as_dict(), )
def testInvalidCardNumber(self): with self.assertRaises(AttributeError): CardNumber("123", "123")
def testTokenGenerate(self): number_token = self.service.generate( CardNumber("5155901222280001", "customer_21081826")) self.assertIsInstance(number_token, CardToken) self.assertIsNotNone(number_token.number_token)
def testInvalidCustomerId(self): with self.assertRaises(AttributeError): CardNumber("5155901222280001", "a" * 101)
def test_invalid_card_number(): with pytest.raises(AttributeError): CardNumber("123", "123")
def test_get_as_dict(): object = CardNumber("5155901222280001", "customer_21081826") assert { "card_number": "5155901222280001", "customer_id": "customer_21081826", } == object.as_dict()
def test_invalid_customer_id(): with pytest.raises(AttributeError): CardNumber("5155901222280001", "a" * 101)
def card_number(): return CardNumber("5155901222280001", "customer_21081826")
def setUp(self) -> None: self.card_number = CardNumber("5155901222280001", "customer_21081826")