Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
wbcrm / tests / test_models / test_contacts.py
Size: Mime:
import pytest

from crm.factories.contacts import AddressContactFactory

@pytest.mark.django_db
class TestPrimaryContactMixin:

    def test_primary_contact(self, person_without_contacts):
        # TODO: Refactor into multiple methods
        assert person_without_contacts.primary_address_contact() is None
        address1 = AddressContactFactory(entry=person_without_contacts, primary=True)
        assert person_without_contacts.primary_address_contact() == address1
        address2 = AddressContactFactory(entry=person_without_contacts, primary=True)
        address1.refresh_from_db()
        assert person_without_contacts.primary_address_contact() == address2
        assert address1.primary is False
        address1.primary = True
        address1.save()
        assert person_without_contacts.primary_address_contact() == address1
        assert address1.primary is True
        address2.refresh_from_db()
        assert address2.primary is False





@pytest.mark.django_db
class TestBankingContact:

    def test_to_str(self, banking_contact):
        assert str(banking_contact) == "{0.institute}, {0.iban}".format(banking_contact)

@pytest.mark.django_db
class TestAddressContact:

    def test_to_str(self, address_contact):
        assert str(address_contact) == "{0.street}, {0.zip} {0.city}, {0.country}".format(address_contact)

@pytest.mark.django_db
class TestTelephoneContact:

    def test_to_str(self, telephone_contact):
        assert str(telephone_contact) == telephone_contact.number

@pytest.mark.django_db
class TestEmailContact:

    def test_to_str(self, email_contact):
        assert str(email_contact) == email_contact.address

@pytest.mark.django_db
class TestWebsiteContact:

    def test_to_str(self, website_contact):
        assert str(website_contact) == website_contact.url