예제 #1
0
 def test_ok(self):
     with patch("gobstuf.rest.brp.rest_response.request", mock_request):
         result = RESTResponse.ok(any_data)
         response = json.loads(result['response'])
         self.assertEqual(result['content_type'], 'application/hal+json')
         self.assertEqual(result['status'], 200)
         self.assertEqual(response, RESTResponse._hal(any_data))
예제 #2
0
 def test_hal(self):
     with patch("gobstuf.rest.brp.rest_response.request", mock_request):
         hal = RESTResponse._hal(any_data)
         self.assertEqual(hal, {
             '_links': {
                 'self': {
                     'href': 'any url'
                 }
             },
             'any': 'data'
         })