class CustomerTest(TestCase): def setUp(self): self.address = Address.objects.create( address=u'Avenida Engenheiro Eusébio Stevaux, 100', complement='Bloco A', district='Jurubatuba', city=u'São Paulo', uf='SP', cep='04696000' ) self.obj = Customer( first_name='Regis', last_name='da Silva', cpf='11122233396', birthday='1979-05-31', email='*****@*****.**', phone='11-2600-2500', cell='11-98700-0000', address=self.address ) # CPF válido: 33322211169, 55566678963 def test_create(self): """ Customer must have first_name, last_name, cpf, birthday, email, phone, cell, address, complement, district, city, uf, cep """ self.obj.save() self.assertEqual(1, self.obj.pk) def test_has_created_at(self): 'Customer must have automatic created_at' self.obj.save() self.assertIsInstance(self.obj.created_at, datetime)
def setUp(self): self.address = Address.objects.create( address=u'Avenida Engenheiro Eusébio Stevaux, 100', complement='Bloco A', district='Jurubatuba', city=u'São Paulo', uf='SP', cep='04696000' ) self.obj = Customer( first_name='Regis', last_name='da Silva', cpf='11122233396', birthday='1979-05-31', email='*****@*****.**', phone='11-2600-2500', cell='11-98700-0000', address=self.address )