relocate build url with base_url

This commit is contained in:
debugtalk
2019-04-08 14:11:49 +08:00
parent 7a7c5503f8
commit 1c207e2dc4
5 changed files with 18 additions and 26 deletions

View File

@@ -7,7 +7,7 @@ from tests.base import ApiServerUnittest
class TestHttpClient(ApiServerUnittest):
def setUp(self):
super(TestHttpClient, self).setUp()
self.api_client = HttpSession(self.host)
self.api_client = HttpSession()
self.headers = self.get_authenticated_headers()
self.reset_all()
@@ -30,7 +30,7 @@ class TestHttpClient(ApiServerUnittest):
self.assertEqual(True, resp.json()['success'])
def test_request_without_base_url(self):
url = "/api/users/1000"
url = "{}/api/users/1000".format(self.host)
data = {
'name': 'user1',
'password': '123456'
@@ -40,7 +40,7 @@ class TestHttpClient(ApiServerUnittest):
self.assertEqual(True, resp.json()['success'])
def test_request_post_data(self):
url = "/api/users/1000"
url = "{}/api/users/1000".format(self.host)
data = {
'name': 'user1',
'password': '123456'
@@ -56,7 +56,7 @@ class TestHttpClient(ApiServerUnittest):
self.assertIn("password=123456", resp.request.body)
def test_request_with_cookies(self):
url = "/api/users/1000"
url = "{}/api/users/1000".format(self.host)
data = {
'name': 'user1',
'password': '123456'