예제 #1
0
 def test_get_method_return_json_data_when_response_is_200(self, request_mock):
     request_mock.get.return_value = mock.Mock(status_code=200,
                                               text=json.dumps({'message': 'ok'}))
     response = Facebook.get('http://localhost/')
     self.assertEqual('ok', response['message'])
예제 #2
0
 def test_get_method_return_none_when_response_is_404(self, request_mock):
     request_mock.get.return_value = mock.Mock(status_code=404)
     self.assertEqual(None, Facebook.get('http://localhost/'))