1 ##############################################################################
2 # Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
13 from yardstick.common import httpClient
16 class HttpClientTestCase(unittest.TestCase):
18 @mock.patch('yardstick.common.httpClient.requests')
19 def test_post(self, mock_requests):
20 url = 'http://localhost:5000/hello'
21 data = {'hello': 'world'}
22 headers = {'Content-Type': 'application/json'}
23 httpClient.HttpClient().post(url, data)
24 mock_requests.post.assert_called_with(url, data=json.dumps(data),
32 if __name__ == '__main__':