コード例 #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)
コード例 #2
0
ファイル: test_models.py プロジェクト: horosin/mcod-backend
 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
コード例 #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
コード例 #4
0
ファイル: test_models.py プロジェクト: horosin/mcod-backend
 def test_short_description_no_description(self):
     org = Organization()
     org.description = None
     assert '' == org.short_description
コード例 #5
0
ファイル: test_models.py プロジェクト: horosin/mcod-backend
 def test_short_description(self):
     org = Organization()
     org.description = "<p>Paragraph</p>"
     assert 'Paragraph' == org.short_description
コード例 #6
0
ファイル: test_models.py プロジェクト: horosin/mcod-backend
 def test_get_url_path_no_reverse(self):
     org = Organization()
     assert '' == org.get_url_path()
コード例 #7
0
ファイル: test_models.py プロジェクト: horosin/mcod-backend
 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
コード例 #8
0
def inactive_organization():
    organization = Organization()
    organization.slug = "test"
    organization.title = "test"
    return organization
コード例 #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
コード例 #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