Exemplo n.º 1
0
 def test_clean(self):
     """
     Test that clean method doesn't raise error if company with similar name doesn't exist.
     """
     models.Company.objects.create(name="Foo company")
     company = models.Company(name="Foo company 1")
     company.clean()
Exemplo n.º 2
0
 def test_company_address(self):
     """
     Test that company_address returns Company string
     """
     company = models.Company(name="Foo company",
                              address_street="Foo street")
     self.assertEqual(company.company_address(), "Foo street")
Exemplo n.º 3
0
 def test_clean_ico_error_not_changed(self):
     """
     Test that clean method doesn't raises error if company with same ico exists, but nothing changed on self.
     """
     models.Company.objects.create(name="Foo", ico=12345)
     company = models.Company(name="Bar", ico=12345)
     company.save()
     company.clean()
Exemplo n.º 4
0
 def test_clean_ico_error(self):
     """
     Test that clean method raises error if company with same ico exists.
     """
     models.Company.objects.create(name="Foo", ico=12345)
     company = models.Company(name="Bar", ico=12345)
     with self.assertRaisesRegex(
             ValidationError,
             "Organizace s tímto IČO již existuje, nezakládemte prosím novou, ale vyberte jí prosím ze seznamu",
     ):
         company.clean()
Exemplo n.º 5
0
 def test_clean_name_error(self):
     """
     Test that clean method raises error if company with similar name exists.
     """
     models.Company.objects.create(name="Foo company")
     company = models.Company(name="Foo Čömpany")
     with self.assertRaisesRegex(
             ValidationError,
             "Organizace s tímto názvem již existuje. Nemusíte tedy zakládat novou, vyberte tu stávající."
     ):
         company.clean()
Exemplo n.º 6
0
 def test_has_filled_contact_information(self):
     """
     Test that has_filled_contact_information returns True if address information is complete
     """
     company = models.Company(
         name="Foo company",
         ico=123,
         address_street="Foo street",
         address_street_number=123,
         address_psc=12345,
         address_city="Foo city",
     )
     self.assertEqual(company.has_filled_contact_information(), True)
Exemplo n.º 7
0
 def test_has_filled_contact_information_false(self):
     """
     Test that has_filled_contact_information returns False if address information is not complete
     """
     company = models.Company(name="Foo company")
     self.assertEqual(company.has_filled_contact_information(), False)
Exemplo n.º 8
0
 def test_str(self):
     """
     Test that __str__ returns Company string
     """
     company = models.Company(name="Foo company")
     self.assertEqual(str(company), "Foo company")
Exemplo n.º 9
0
 def test_admin_telephones_blank(self):
     """
     Test that admin_telephones returns "" if no company admin exists
     """
     company = models.Company(name="Foo company")
     self.assertEqual(company.admin_telephones(None), "")