Example #1
0
 def test_repr(self):
     self.client.call = Mock()
     template = oca.VmTemplate(self.xml, self.client)
     assert repr(template) == '<oca.VmTemplate("test1")>'
Example #2
0
 def test_chown(self):
     self.client.call = Mock()
     template = oca.VmTemplate(self.xml, self.client)
     template.chown(2, 3)
     self.client.call.assert_called_once_with('template.chown', '1', 2, 3)
Example #3
0
 def test_instantiate_with_custom_name(self):
     self.client.call = Mock()
     template = oca.VmTemplate(self.xml, self.client)
     template.instantiate('asd')
     self.client.call.assert_called_once_with('template.instantiate', '1',
                                              'asd')
Example #4
0
 def test_update(self):
     self.client.call = Mock()
     template = oca.VmTemplate(self.xml, self.client)
     template.update('name=b')
     self.client.call.assert_called_once_with('template.update', '1',
                                              'name=b')
Example #5
0
 def test_unpublish(self):
     self.client.call = Mock()
     template = oca.VmTemplate(self.xml, self.client)
     template.unpublish()
     self.client.call.assert_called_once_with('template.publish', '1',
                                              False)
Example #6
0
 def test_delete(self):
     self.client.call = Mock()
     template = oca.VmTemplate(self.xml, self.client)
     template.delete()
     self.client.call.assert_called_once_with('template.delete', '1')
Example #7
0
 def test_instantiate_with_custom_name_and_context(self):
     self.client.call = Mock()
     template = oca.VmTemplate(self.xml, self.client)
     template.instantiate('asd', False, 'VCPU=4')
     self.client.call.assert_called_once_with('template.instantiate', '1',
                                              'asd', False, 'VCPU=4')
Example #8
0
 def test_instantiate_with_default_name(self):
     self.client.call = Mock()
     template = oca.VmTemplate(self.xml, self.client)
     template.instantiate()
     self.client.call.assert_called_once_with('template.instantiate', '1',
                                              '', False, '')
Example #9
0
 def test_instantiate_with_default_name_and_context(self):
     self.client.call = Mock(return_value=6)
     template = oca.VmTemplate(self.xml, self.client)
     assert template.instantiate('', False, 'VCPU=4') == 6
     self.client.call.assert_called_once_with('template.instantiate', '1',
                                              '', False, 'VCPU=4')
Example #10
0
 def test_instantiate_with_custom_name(self):
     self.client.call = Mock(return_value=5)
     template = oca.VmTemplate(self.xml, self.client)
     assert template.instantiate('asd') == 5
     self.client.call.assert_called_once_with('template.instantiate', '1',
                                              'asd', False, '')