def setUpTestData(cls):
     cls.unavailable_status = DomainStatusFactory(domain_status="Unavailable")
     cls.domain = DomainFactory(expiration=date.today() + timedelta(days=360))
     cls.unavailable_domain = DomainFactory(
         domain_status=cls.unavailable_status,
         expiration=date.today() + timedelta(days=360),
     )
     cls.expired_domain = DomainFactory(expiration=date.today() - timedelta(days=30))
     cls.project = ProjectFactory()
Exemple #2
0
    def test_prop_count_status(self):
        status = DomainStatusFactory(domain_status="Available")
        DomainFactory(domain_status=status)

        try:
            count = status.count
            self.assertEqual(count, 1)
        except Exception:
            self.fail(
                "DomainStatus model `count` property failed unexpectedly!")
Exemple #3
0
    def test_crud(self):
        # Create
        status = DomainStatusFactory(domain_status="Available")

        # Read
        self.assertEqual(status.domain_status, "Available")
        self.assertEqual(status.pk, status.id)
        self.assertQuerysetEqual(
            self.DomainStatus.objects.all(),
            [f"<DomainStatus: {status}>"],
        )

        # Update
        status.domain_status = "Unavailable"
        status.save()
        self.assertEqual(status.domain_status, "Unavailable")

        # Delete
        status.delete()
        assert not self.DomainStatus.objects.all().exists()
Exemple #4
0
 def setUpTestData(cls):
     cls.History = HistoryFactory._meta.model
     cls.available_status = DomainStatusFactory(domain_status="Available")
     cls.unavailable_status = DomainStatusFactory(
         domain_status="Unavailable")