Пример #1
0
    def test_rest_object(self):
        json_data = {
            'name': 'Dive into Python',
            'resource_url': 'http://localhost/api/book/1',
            'author': {
                'name': 'Mark Pelgrim',
                'resource_url': 'http://localhost/api/author/1',
            }
        }
        
        rest_data = restify(json_data, self.mock_resource)
        
        self.assertIsInstance(rest_data, RestObject)
        #self.assertTrue(rest_data.resource_url)

        # Nested
        self.assertIsInstance(rest_data['author'], RestObject)
Пример #2
0
    def test_rest_object(self):
        json_data = {
            'name': 'Dive into Python',
            'resource_url': 'http://localhost/api/book/1',
            'author': {
                'name': 'Mark Pelgrim',
                'resource_url': 'http://localhost/api/author/1',
            }
        }

        rest_data = restify(json_data, self.mock_resource)

        self.assertIsInstance(rest_data, RestObject)
        #self.assertTrue(rest_data.resource_url)

        # Nested
        self.assertIsInstance(rest_data['author'], RestObject)
Пример #3
0
    def __init__(self, data=None, client=None, absolute_url=None):
        self.client = client
        self.absolute_url = absolute_url

        self.data = restify(data, self)
Пример #4
0
    def __init__(self, data=None, client=None, absolute_url=None):
        self.client = client
        self.absolute_url = absolute_url

        self.data = restify(data, self)