예제 #1
0
 def setUp(self) -> None:
     obj = Kita(name='Kita',
                street_name='Foobar',
                number=12,
                postal_code=12345,
                email='*****@*****.**')
     obj.save()
     KitaRepresentative(first_name='Jon',
                        name='Doe',
                        email='*****@*****.**',
                        kita=obj).save()
     KitaRepresentative(first_name='Jane',
                        name='Doe',
                        email='*****@*****.**',
                        kita=obj).save()
예제 #2
0
 def test_postalcode_invalid_str(self):
     try:
         Kita(name='Kita',
              street_name='Foobar',
              number=12,
              postal_code='12345',
              email='*****@*****.**')
     except ValidationError:
         pass
예제 #3
0
    def _save_kita_entry(data: dict):
        street_key = 'street' if 'street' in data else 'street_name'
        postal_key = 'plz' if 'plz' in data else 'postal_code'

        num = int(data['number']) if data['number'] else 0
        postal = int(data[postal_key]) if data[postal_key] else 12345
        street = data[street_key] if data[street_key] else '-----'

        Kita(name=data['name'],
             email=data['email'],
             street_name=street,
             number=num,
             postal_code=postal).save()
예제 #4
0
 def test_create_kita(self):
     obj = Kita(name='Kita',
                street_name='Foobar',
                number=12,
                postal_code=12345,
                email='*****@*****.**')
     obj.save()
     obj.refresh_from_db()
     self.assertIsNotNone(obj)
예제 #5
0
 def setUp(self) -> None:
     Kita(name='Test',
          street_name='abcdefghijk',
          number='12a',
          postal_code=12345,
          email='*****@*****.**').save()