-Removed old tests altogether now its benchmarking time
This commit is contained in:
parent
d44ba36e58
commit
aaa1378af8
@ -84,15 +84,14 @@ class Worker:
|
||||
|
||||
# Build the request and store it in our structure
|
||||
url = self.domain + path
|
||||
req = Request(method, url, opts)
|
||||
req = http.Request(method, url, opts)
|
||||
r_id = time.time()
|
||||
self.requests[r_id] = req
|
||||
|
||||
resp = req.make(expectation)
|
||||
self.responses[r_id] = resp
|
||||
|
||||
return req.id
|
||||
|
||||
return r_id
|
||||
|
||||
|
||||
def run(worker: Worker):
|
||||
@ -116,61 +115,24 @@ def run(worker: Worker):
|
||||
{'init': ['post', '/channels/list', {}], 'auth': jwt, 'hope': 200},
|
||||
|
||||
# somehow save this garbino
|
||||
{'init': ['post', '/channels/create', {name: str(new_channel_name), kind: 2, description: 'asdf'}], 'auth': jwt, 'hope': 200},
|
||||
{'init': ['post', '/channels/create', {'name': str(new_channel_name), 'kind': 2, 'description': 'asdf'}], 'auth': jwt, 'hope': 200},
|
||||
# Just a regular test no saving for this one
|
||||
{'init': ['post', '/channels/create', {name: str(new_channel_name+1), kind: 2,}], 'auth': jwt, 'hope': 200},
|
||||
{'init': ['post', '/channels/create', {'name': str(new_channel_name+1), 'kind': 2,}], 'auth': jwt, 'hope': 200},
|
||||
|
||||
{'init': ['post', '/channels/create', {}], 'auth': jwt, 'hope': 400},
|
||||
{'init': ['post', '/channels/create', {name: 123, kind: 'adsf'}], 'auth': jwt, 'hope': 400},
|
||||
{'init': ['post', '/channels/create', {'name': 123, 'kind': 'adsf'}], 'auth': jwt, 'hope': 400},
|
||||
|
||||
# save this and compare its results to the previous
|
||||
{'init': ['get', '/channels/list', {}], 'auth': jwt, 'hope': 200},
|
||||
{'init': ['get', '/channels/list', {'random-param': 123}], 'auth': jwt, 'hope': 200},
|
||||
|
||||
{'init': ['post'], 'auth': jwt, 'hope': 200}
|
||||
]
|
||||
|
||||
for test in channel_tests:
|
||||
method = test['init'][0]
|
||||
path = test['init'][1]
|
||||
opts = test['init'][2]
|
||||
|
||||
worker.request(method, path, test['auth'], opts, test['hope'])
|
||||
|
||||
|
||||
# # pass 200
|
||||
# worker.post('/message/send', jwt=jwt, channel=newchannel['id'], content='some bullshit message')
|
||||
#
|
||||
# # pass 200
|
||||
# worker.delete('/channels/delete', jwt=jwt, channel_id=newchannel['id'])
|
||||
#
|
||||
# # fail 400
|
||||
# worker.post('/channels/create', jwt=False, name=f'succ', kind=2)
|
||||
#
|
||||
# # pass 200
|
||||
# worker.get('/meta', jwt=jwt)
|
||||
#
|
||||
#
|
||||
# # Getting messages now
|
||||
# # pass 200
|
||||
# send_chan = worker.post('/channels/create', jwt=jwt, name=f'{cname}', kind=2, description='some description')
|
||||
# send_chan = json.loads(send_chan)
|
||||
# # pass 200(all)
|
||||
# spam_messages(send_chan['id'], jwt, worker)
|
||||
# now = time.time()
|
||||
# messages = json.loads(worker.get('/message/get_range', jwt=jwt, **{
|
||||
# 'start-time': int(now - 15),
|
||||
# 'end-time': int(now + 1),
|
||||
# 'channel': send_chan['id']
|
||||
# }))
|
||||
#
|
||||
# # 200 pass
|
||||
# from_id = worker.get('/message/from_id', jwt=jwt, **{
|
||||
# 'channel': send_chan['id'],
|
||||
# 'start': messages['messages'][0]['id']
|
||||
# })
|
||||
# print('done')
|
||||
method, path, opts = test['init']
|
||||
auth = test['auth']
|
||||
hope = test['hope']
|
||||
|
||||
worker.request(method, path, auth, opts, hope)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
Reference in New Issue
Block a user