Revision 9dcfad23 snf-cyclades-app/synnefo/logic/tests/servers.py

b/snf-cyclades-app/synnefo/logic/tests/servers.py
72 72
        # error in enqueue. check the vm is deleted and resources released
73 73
        mrapi().CreateInstance.side_effect = Exception("ganeti is down")
74 74
        with mocked_quotaholder():
75
            self.assertRaises(Exception, servers.create, **kwargs)
75
            servers.create(**kwargs)
76 76
        vm = models.VirtualMachine.objects.get()
77
        self.assertTrue(vm.deleted)
78
        self.assertEqual(len(vm.nics.all()), 0)
79
        vm.delete()
77
        self.assertFalse(vm.deleted)
78
        self.assertEqual(vm.operstate, "ERROR")
79
        self.assertEqual(len(vm.nics.all()), 1)
80
        for nic in vm.nics.all():
81
            self.assertEqual(nic.state, "ERROR")
80 82

  
81 83
        # success with no nics
82 84
        mrapi().CreateInstance.side_effect = None
......
85 87
                               DEFAULT_INSTANCE_NETWORKS=[]):
86 88
            with mocked_quotaholder():
87 89
                vm = servers.create(**kwargs)
88
        self.assertEqual(models.VirtualMachine.objects.count(), 1)
89 90
        vm = models.VirtualMachine.objects.get(id=vm.id)
90 91
        self.assertEqual(vm.nics.count(), 0)
91 92
        self.assertEqual(vm.backendjobid, 42)

Also available in: Unified diff