Exemplo n.º 1
0
    def test_request_alias_change(self):
        server = ServerFactory()
        ipaddress = IPAddressFactory(server=server)
        alias = AliasFactory(ip_address=ipaddress)
        newipaddress = IPAddressFactory()

        response = self.c.post("/alias/%d/request_alias_change/" % alias.id, {
            'new_ipaddress': newipaddress.id,
        })
        self.assertEquals(response.status_code, 302)
        response = self.c.get("/alias/%d/" % alias.id)
        self.assertContains(response, 'pending')
Exemplo n.º 2
0
    def test_alias_change(self):
        server = ServerFactory()
        ipaddress = IPAddressFactory(server=server)
        alias = AliasFactory(ip_address=ipaddress)
        newipaddress = IPAddressFactory()

        response = self.c.post(reverse('alias-change', args=[alias.id]), {
            'new_ipaddress': newipaddress.id,
        })
        self.assertEquals(response.status_code, 302)
        response = self.c.get("/alias/%d/" % alias.id)
        self.assertContains(response, newipaddress.server.name)
Exemplo n.º 3
0
    def test_request_alias(self):
        server = ServerFactory()
        IPAddressFactory(server=server)

        response = self.c.post(
            "/server/%d/request_alias/" % server.id, {
                'hostname': 'test.example.com',
                'description': 'a description',
                'administrative_info': 'admin info',
                'contact': 'Anders,Jonah',
            })
        self.assertEquals(response.status_code, 302)
        response = self.c.get("/server/%d/" % server.id)
        self.assertContains(response, 'test.example.com')

        a = Alias.objects.get(hostname='test.example.com')
        response = self.c.get("/alias/%d/" % a.id)
        self.assertEqual(response.status_code, 200)