+ Mostly adding quality of life changes in this patch with the mock client
These changes will make it easier to read through verbose logs with some tactful colors (yellow)
This commit is contained in:
parent
181b1cadc4
commit
34115477ab
@ -8,6 +8,15 @@ class Server:
|
||||
self.wsurl = meta.get('wsurl')
|
||||
self.serv_name = meta.get('name')
|
||||
|
||||
def __str__(self) -> str:
|
||||
fields = {
|
||||
'url': self.url,
|
||||
'wsurl': self.wsurl,
|
||||
'name': self.serv_name
|
||||
}
|
||||
return str(fields)
|
||||
|
||||
|
||||
class Admin:
|
||||
def __init__(self, user: dict, server: dict):
|
||||
self.id = user.get('id')
|
||||
@ -33,6 +42,7 @@ def create_admin() -> Admin :
|
||||
raw = json.loads(proc.stdout)
|
||||
user = raw.get('user')
|
||||
server = raw.get('server')
|
||||
print(f'Raw data to use as user: {raw}')
|
||||
if user is None or server is None:
|
||||
return None
|
||||
else:
|
||||
|
@ -4,6 +4,7 @@ import requests
|
||||
NC = '\033[0m'
|
||||
RED = '\033[1;31m'
|
||||
GREEN = '\033[1;32m'
|
||||
YELLOW = '\033[1;33m'
|
||||
|
||||
class Request:
|
||||
|
||||
@ -56,23 +57,23 @@ class Request:
|
||||
print(abstract)
|
||||
print('\t', self.method, ' ', self.url)
|
||||
if len(self.headers) != 0:
|
||||
print('\tRequest-Headers ', self.headers)
|
||||
print(YELLOW + '\tRequest-Headers ' + NC, self.headers)
|
||||
|
||||
if len(self.qs) != 0:
|
||||
print('\tQuery-Dictionary ', self.qs)
|
||||
print(YELLOW + '\tQuery-Dictionary' + NC, self.qs)
|
||||
|
||||
if self.body is not None:
|
||||
print('\tRequest-Body ', str(self.body))
|
||||
print(YELLOW + '\tRequest-Body' + NC, str(self.body))
|
||||
|
||||
if self.verbose:
|
||||
print(f'\tResponse-Status {self.response.status_code}')
|
||||
print(f'\tResponse-Headers {self.response.headers}')
|
||||
print(f'\tResponse-Text {self.response.text}')
|
||||
print(f'\t{YELLOW}Response-Status{NC} {self.response.status_code}')
|
||||
print(f'\t{YELLOW}Response-Headers{NC} {self.response.headers}')
|
||||
print(f'\t{YELLOW}Response-Text{NC} {self.response.text}')
|
||||
|
||||
else:
|
||||
print(f'{GREEN}Pass{NC} {self.method} {self.url}')
|
||||
if self.verbose:
|
||||
print(f'\tResponse-Status {self.response.status_code}')
|
||||
print(f'\tResponse-Headers {self.response.headers}')
|
||||
print(f'\tResponse-Text {self.response.text}')
|
||||
print(f'\t{YELLOW}Response-Status{NC} {self.response.status_code}')
|
||||
print(f'\t{YELLOW}Response-Headers{NC} {self.response.headers}')
|
||||
print(f'\t{YELLOW}Response-Text{NC} {self.response.text}')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user