Exemple #1
0
    def test_name_uniqness(self, valid_organization):
        org = Organization()
        org.slug = valid_organization.slug
        with pytest.raises(ValidationError) as e:
            org.full_clean()

        assert "'slug': " in str(e.value)
Exemple #2
0
 def test_required_fields_validation(self):
     org = Organization()
     with pytest.raises(ValidationError) as e:
         org.full_clean()
     e = str(e.value)
     assert "'title'" in e
     assert "'postal_code'" in e
     assert "'city'" in e
     assert "'street'" in e
     # assert "'street_number'" in e
     # assert "'flat_number'" in e
     assert "'street_type'" in e
     assert "'email'" in e
     assert "'fax'" in e
     assert "'tel'" in e
     assert "'epuap'" in e
     assert "'regon'" in e
     assert "'website'" in e
Exemple #3
0
def create_organization(param):
    org = Organization()
    org.slug = param
    org.title = param
    org.postal_code = "00-001"
    org.city = "Warszwa"
    org.street = "Królewska"
    org.street_number = "27"
    org.flat_number = "1"
    org.street_type = "ul"
    org.email = "*****@*****.**"
    org.fax = "123123123"
    org.tel = "123123123"
    org.epuap = "epuap"
    org.regon = "123123123"
    org.website = "www.www.www"
    org.save()
    return org
Exemple #4
0
 def test_short_description_no_description(self):
     org = Organization()
     org.description = None
     assert '' == org.short_description
Exemple #5
0
 def test_short_description(self):
     org = Organization()
     org.description = "<p>Paragraph</p>"
     assert 'Paragraph' == org.short_description
Exemple #6
0
 def test_get_url_path_no_reverse(self):
     org = Organization()
     assert '' == org.get_url_path()
Exemple #7
0
 def test_organization_create(self):
     organization = Organization()
     organization.slug = "test"
     organization.title = "test"
     organization.postal_code = "00-001"
     organization.city = "Warszwa"
     organization.street = "Królewska"
     organization.street_number = "27"
     organization.flat_number = "1"
     organization.street_type = "ul"
     organization.email = "*****@*****.**"
     organization.fax = "123123123"
     organization.tel = "123123123"
     organization.epuap = "epuap"
     organization.regon = "123123123"
     organization.website = "www.www.www"
     assert organization.id is None
     organization.save()
     assert organization.id is not None
     assert Organization.objects.last().id == organization.id
Exemple #8
0
def inactive_organization():
    organization = Organization()
    organization.slug = "test"
    organization.title = "test"
    return organization
Exemple #9
0
def valid_organization2():
    organization = Organization()
    organization.slug = "zlodzieje-cienia"
    organization.title = "Złodzieje cienia"
    organization.postal_code = "00-002"
    organization.city = "Wrota Baldura"
    organization.street = "Schowana"
    organization.street_number = "3"
    organization.flat_number = "1"
    organization.street_type = "ul"
    organization.email = "*****@*****.**"
    organization.fax = "321321321"
    organization.tel = "321321321"
    organization.epuap = "shthv"
    organization.regon = "321321321"
    organization.website = "www.shadowthieves.bg"
    organization.save()
    return organization
Exemple #10
0
def valid_organization():
    organization = Organization()
    organization.slug = "test"
    organization.title = "test"
    organization.postal_code = "00-001"
    organization.city = "Warszwa"
    organization.street = "Królewska"
    organization.street_number = "27"
    organization.flat_number = "1"
    organization.street_type = "ul"
    organization.email = "*****@*****.**"
    organization.fax = "123123123"
    organization.tel = "123123123"
    organization.epuap = "epuap"
    organization.regon = "123123123"
    organization.website = "www.www.www"
    organization.save()
    return organization