def test_selecting_two_servers(self): entry = DomainServerConnectionFactory() entry.static_server = ServerHistoryFactory() entry.transient_server = TransientServerFactory() with self.assertRaises(IntegrityError): entry.save()
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__
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()
def setUpTestData(cls): cls.project = ProjectFactory() cls.server = TransientServerFactory(project=cls.project) cls.server_dict = cls.server.__dict__