def test_create_instance_with_network(self):
        first_item = self.populate_db()

        first_disk = Disk(name='test', size=20, instance=first_item)
        first_disk.save()
        first_nw = Network(name='test', bridge=1, instance=first_item)
        first_nw.save()
    def test_create_and_retrieve_instance_with_disk(self):
        first_item = self.populate_db()

        first_disk = Disk(name='test', instance=first_item)
        first_disk.save()

        instance = Instance.objects.all().filter(pk=first_item.id)
        disk = Disk.objects.all().filter(instance_id=first_item.id)
        item = instance[0]
        self.assertEqual(item.name, 'Instance1')
        self.assertEqual(disk.count(), 1)
Exemple #3
0
    def test_vps_view_instance(self):
        first_item = Instance()
        first_item.name = 'My old list item'
        first_item.description = 'My description'
        first_item.image = 1
        first_item.memory = 512
        first_item.disk = 30
        first_item.bridge = 2
        first_item.create_disk = False
        first_item.create_path = False
        first_item.save()

        disk = Disk()
        disk.name = 'My old list item'
        disk.instance = first_item
        disk.save()

        network = Network()
        network.name = 'Another test'
        network.instance = first_item
        network.save()

        response = self.client.get('/vps/1/')
        self.assertEquals(response.status_code, 200)
        self.assertTemplateUsed('viewvps.html')
        self.assertContains(response, 'VPS Manager')
Exemple #4
0
    def populate_instances():
        first_item = Instance()
        first_item.name = 'My old list item'
        first_item.description = 'My description'
        first_item.image = 1
        first_item.memory = 512
        first_item.disk = 30
        first_item.bridge = 2
        first_item.create_disk = False
        first_item.create_path = False
        first_item.save()

        second_item = Disk()
        second_item.instance = first_item
        second_item.name = 'test'
        second_item.size = int(30)
        second_item.save()
Exemple #5
0
    def test_stop_vps(self):
        first_item = self.populate_instance()

        disk = Disk()
        disk.name = 'My old list item'
        disk.instance = first_item
        disk.save()

        network = Network()
        network.name = 'Another test'
        network.instance = first_item
        network.save()

        response = self.client.get('/vps/stop/608/')
        self.assertEquals(response.status_code, 200)
Exemple #6
0
    def test_start_vps(self, fake_make_call_to_vpssvr):
        fake_make_call_to_vpssvr.return_value = True

        first_item = self.populate_instance()

        disk = Disk()
        disk.name = 'My old list item'
        disk.instance = first_item
        disk.save()

        network = Network()
        network.name = 'Another test'
        network.instance = first_item
        network.save()

        response = self.client.get('/vps/stop/608/')
        self.assertEquals(response.status_code, 200)
    def test_create_instance_with_disk(self):
        first_item = self.populate_db()

        first_disk = Disk(name='test', instance=first_item)
        first_disk.save()