def test_restful_loaddict(self): model = Restful() model.endpoint = 'resource_uri' model.subsystem = "subsystem" resource_uri = "/".join([ "api", model.subsystem, model._api_version, model.endpoint.lstrip("/"), model.pk ]) model._loaddict({'key': 'value', "resource_uri": resource_uri}) self.assertEqual('value', model.key) self.assertEqual(resource_uri, model._resource_uri) self.assertEqual([], model.__getchanges__())
def test_restful_loaddict(self): model = Restful() self.assertRaises(AssertionError, model._loaddict, {"key": "value"}) model.endpoint = "endpoint" model.subsystem = "subsystem" model._loaddict({"key": "value"}) self.assertEqual("value", model.key) self.assertEqual( "/".join(["api", model.subsystem, model._api_version, model.endpoint.lstrip("/"), model.pk]), model._detail_uri, ) self.assertEqual([], model.__getchanges__())
def test_restful_loaddict(self): model = Restful() self.assertRaises(AssertionError, model._loaddict, {'key': 'value'}) model.endpoint = 'endpoint' model.subsystem = "subsystem" model._loaddict({'key': 'value'}) self.assertEqual('value', model.key) self.assertEqual( "/".join([ "api", model.subsystem, model._api_version, model.endpoint.lstrip("/"), model.pk ]), model._detail_uri) self.assertEqual([], model.__getchanges__())