예제 #1
0
    def test_selecting_two_servers(self):
        entry = DomainServerConnectionFactory()
        entry.static_server = ServerHistoryFactory()
        entry.transient_server = TransientServerFactory()

        with self.assertRaises(IntegrityError):
            entry.save()
예제 #2
0
 def setUpTestData(cls):
     cls.project = ProjectFactory()
     cls.domain = HistoryFactory(project=cls.project)
     cls.server = ServerHistoryFactory(project=cls.project)
     cls.vps = TransientServerFactory(project=cls.project)
     cls.link = DomainServerConnectionFactory(
         project=cls.project,
         domain=cls.domain,
         static_server=cls.server,
         transient_server=None,
     )
     cls.link_dict = cls.link.__dict__
예제 #3
0
    def test_crud(self):
        # Create
        server = TransientServerFactory(ip_address="192.168.1.100")

        # Read
        self.assertEqual(server.ip_address, "192.168.1.100")
        self.assertEqual(server.pk, server.id)
        self.assertQuerysetEqual(
            self.TransientServer.objects.all(),
            [
                f"<TransientServer: {server.ip_address} ({server.name}) [{server.server_provider}]>"
            ],
        )

        # Update
        server.ip_address = "192.168.2.200"
        server.save()
        self.assertEqual(server.ip_address, "192.168.2.200")

        # Delete
        server.delete()
        assert not self.TransientServer.objects.all().exists()
예제 #4
0
 def setUpTestData(cls):
     cls.project = ProjectFactory()
     cls.server = TransientServerFactory(project=cls.project)
     cls.server_dict = cls.server.__dict__