def test_repr(self): self.client.call = Mock() template = oca.VmTemplate(self.xml, self.client) assert repr(template) == '<oca.VmTemplate("test1")>'
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)
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')
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')
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)
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')
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')
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, '')
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')
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, '')