def test_fetch_error(self): """LXDAPIException is raised on fetch error.""" def error(_, context): context.status_code = 500 return json.dumps({ 'type': 'error', 'error': 'Not found', 'error_code': 500 }) self.add_rule({ 'text': error, 'method': 'GET', 'url': r'^http://pylxd.test/1.0/networks/eth0$', }) network = models.Network(self.client, name='eth0') self.assertRaises(exceptions.LXDAPIException, network.sync)
def test_fetch_error(self): """LXDAPIException is raised on fetch error.""" def error(_, context): context.status_code = 500 return json.dumps({ "type": "error", "error": "Not found", "error_code": 500 }) self.add_rule({ "text": error, "method": "GET", "url": r"^http://pylxd.test/1.0/networks/eth0$", }) network = models.Network(self.client, name="eth0") self.assertRaises(exceptions.LXDAPIException, network.sync)
def test_delete(self): """A network is deleted.""" network = models.Network(self.client, name='eth0') network.delete()
def test_save(self): """save is not implemented in networks.""" an_network = models.Network(self.client, name='lo') with self.assertRaises(NotImplementedError): an_network.save()
def test_partial(self): """A partial network is synced.""" an_network = models.Network(self.client, name='lo') self.assertEqual('loopback', an_network.type)