Beispiel #1
0
    def test_create_get(self):
        request = MockRequest(self.user, has_otp=True, has_sudo=True)
        self.assertEqual(models.Domain.objects.count(), 0)

        response = admin.domain_admin_create(request)
        self.assertEqual(response.status_code, 200)
        self.assertEqual(models.Domain.objects.count(), 0)
Beispiel #2
0
    def test_create_get(self):
        request = MockRequest(self.user, has_otp=True, has_sudo=True)
        self.assertEqual(models.Domain.objects.count(), 0)

        response = admin.domain_admin_create(request)
        self.assertEqual(response.status_code, 200)
        self.assertEqual(models.Domain.objects.count(), 0)
Beispiel #3
0
    def test_create_post_invalid(self):
        request = MockRequest(self.user, has_otp=True, has_sudo=True)
        request.method = "POST"
        request.POST = {}

        self.assertEqual(models.Domain.objects.count(), 0)

        response = admin.domain_admin_create(request)
        self.assertEqual(response.status_code, 200)

        self.assertEqual(models.Domain.objects.count(), 0)
Beispiel #4
0
    def test_create_post_invalid(self):
        request = MockRequest(self.user, has_otp=True, has_sudo=True)
        request.method = "POST"
        request.POST = {}

        self.assertEqual(models.Domain.objects.count(), 0)

        response = admin.domain_admin_create(request)
        self.assertEqual(response.status_code, 200)

        self.assertEqual(models.Domain.objects.count(), 0)
Beispiel #5
0
    def test_create_post(self):
        request = MockRequest(self.user, has_otp=True, has_sudo=True)
        request.method = "POST"
        request.POST = {"domain": "example.com"}

        self.assertEqual(models.Domain.objects.count(), 0)

        response = admin.domain_admin_create(request)
        self.assertEqual(response.status_code, 302)
        self.assertEqual(response["Location"], urlresolvers.reverse("admin:domains:index"))

        domain = models.Domain.objects.get()
        self.assertEqual(domain.owner, None)
        self.assertEqual(domain.enabled, True)
        self.assertEqual(domain.domain, "example.com")
Beispiel #6
0
    def test_create_post(self):
        request = MockRequest(self.user, has_otp=True, has_sudo=True)
        request.method = "POST"
        request.POST = {"domain": "example.com"}

        self.assertEqual(models.Domain.objects.count(), 0)

        response = admin.domain_admin_create(request)
        self.assertEqual(response.status_code, 302)
        self.assertEqual(response["Location"],
                         urlresolvers.reverse("admin:domains:index"))

        domain = models.Domain.objects.get()
        self.assertEqual(domain.owner, None)
        self.assertEqual(domain.enabled, True)
        self.assertEqual(domain.domain, "example.com")