Example #1
0
    def test_response_with_list(self):

        data = {
            'list': [
                {
                    'k1': 'v1',
                    'k2': 'v2'
                },
                {
                    'k1': 'v1',
                    'k2': 'v2'
                },
                {
                    'k1': 'v1',
                    'k2': 'v2'
                },
            ]
        }

        self.response_obj.data = json.dumps(data)

        result = ApiResponse(self.response_obj)

        self.assertEqual(result.status_code, 200)

        self.assertEqual(result.k1, 'v1')
        self.assertEqual(result.k2, 'v2')

        for r in result:
            self.assertEqual(r.k1, 'v1')
            self.assertEqual(r.k2, 'v2')
Example #2
0
    def execute(self):        
        if isinstance(self.message, Smil):
            self._data['smil'] = self.message.render()
        else:
            self._data['smil'] = self.message

        api_response = self.proxy.execute(self.uri, self._data)
        return ApiResponse(api_response)
    def test_responses_empty_list(self):

        data = {'count': 1, 'list': []}

        self.response_obj.data = json.dumps(data)

        result = ApiResponse(self.response_obj)

        self.assertEqual(result.count, 1)
 def test_single_response(self):
     
     data = {'k1': 'v1', 'k2': 'v2'}
 
     self.response_obj.data = json.dumps(data)
     
     result = ApiResponse(self.response_obj)
     
     self.assertEqual(result.status_code, 200)
     self.assertEqual(result.k1, 'v1')
     self.assertEqual(result.k1, 'v1')
Example #5
0
 def execute(self):
     result = self.proxy.execute(self.uri, self._data)
     return ApiResponse(result)
Example #6
0
 def execute(self):
     self._data['list_groups'] = 1
     result = self.proxy.execute(self.uri, self._data)
     return ApiResponse(result)
Example #7
0
 def execute(self):
     api_response = self.proxy.execute(self.uri, self._data)
     return ApiResponse(api_response)
Example #8
0
    def execute(self):
        self._data.update({'credits': 1, 'details': 1})

        result = self.proxy.execute(self.uri, self._data)
        return ApiResponse(result)