Пример #1
0
 def test_three(self):
     request = model.RequestModel('API_1')
     response = http_request.make_post_request(self.client, request)
     self.cookies = utility.get_cookie(response.json())
     if response.json()['detail']['user_name'] == request.body['user_name']:
         response.success()
     else:
         response.failure('Got Wrong Response')
     request = model.RequestModel('API_3')
     request.headers['Cookie'] = self.cookies
     response = http_request.make_post_request(self.client, request)
     if response.json()['result'] == 'successful':
         response.success()
     else:
         response.failure('Got Wrong Response')
Пример #2
0
 def login(self):
     request = model.RequestModel('LOGIN')
     response = http_request.make_post_request(self.client, request)
     if response.status_code == 200:
         response.success()
     else:
         response.failure(response.json())
Пример #3
0
 def test_one(self):
     request = model.RequestModel('API_2')
     response = http_request.make_post_request(self.client, request)
     if response.json()['result'] == 'successful':
         response.success()
     else:
         response.failure('Got Wrong Response')
Пример #4
0
 def test_two(self):
     request = model.RequestModel('API_3')
     request.headers['Cookie'] = self.cookies
     response = http_request.make_post_request(self.client, request)
     if response.json()['result'] == 'successful':
         response.success()
     else:
         response.failure('Got Wrong Response')
Пример #5
0
 def on_start(self):
     request = model.RequestModel('API_1')
     response = http_request.make_post_request(self.client, request)
     self.cookies = utility.get_cookie(response.json())
     if response.json()['detail']['user_name'] == request.body['user_name']:
         response.success()
     else:
         response.failure('Got Wrong Response')
Пример #6
0
 def delete_connection(self):
     request = model.RequestModel('DELETE_CONNECTION')
     request.body['ids'] = json.dumps(self.connection_id)
     response = http_request.make_post_request(self.client, request)
     if response.status_code == 204:
         response.success()
     else:
         response.failure('Delete connection failed')
Пример #7
0
 def connect_connection(self):
     request = model.RequestModel('CONNECT_CONNECTION')
     request.body["config"] = json.dumps(request.body["config"])
     response = http_request.make_post_request(self.client, request)
     if response.status_code == 200:
         response.success()
     else:
         response.failure('Connect connection failed')
Пример #8
0
 def create_connection(self):
     request = model.RequestModel('CREATE_CONNECTION')
     request.body['name'] = utility.unique_name()
     request.body["metadata"] = json.dumps(request.body["metadata"])
     self.connection_id = []
     response = http_request.make_post_request(self.client, request)
     print(response.content)
     if response.status_code == 200:
         self.connection_id = [(response.json()['header']['id'])]
         response.success()
     else:
         response.failure('Create connection failed')