tests are now ran with https as we now use https with nginx as a frontend however:

The client tester is super scuffed and no longer in a pipeline ready state as a new docker image has to be created(again)
This commit is contained in:
shockrah 2021-02-11 20:06:56 -08:00
parent 51fa07158f
commit 6bc8dd0d7d
3 changed files with 26 additions and 4 deletions

View File

@ -213,5 +213,5 @@ def run(worker: Worker):
worker.logs() worker.logs()
if __name__ == '__main__': if __name__ == '__main__':
worker = Worker('http://localhost:4536', create_admin=True) worker = Worker('https://localhost', create_admin=True)
run(worker) run(worker)

View File

@ -4,6 +4,13 @@ import time
import json import json
from urllib.parse import quote from urllib.parse import quote
# TODO/NOTE: this isn't necessary for literally any server that doesn't self-sign
# There's prolly a less retared way of doing this "safely" in testing pipelines
# but im in no rush to figure that out right now
import urllib3
urllib3.disable_warnings()
class RequestError(Exception): class RequestError(Exception):
pass pass
@ -139,13 +146,13 @@ class Request:
url = self.url + self.query_string url = self.url + self.query_string
raw_params = (self.query_string, self.qs_dict) raw_params = (self.query_string, self.qs_dict)
if method == 'get': if method == 'get':
resp = requests.get(url) resp = requests.get(url, verify=False)
return Response('get', url, resp.text, resp.status_code, hope, p=raw_params) return Response('get', url, resp.text, resp.status_code, hope, p=raw_params)
elif method == 'post': elif method == 'post':
resp = requests.post(url, data=self.body) resp = requests.post(url, data=self.body, verify=False)
return Response('post', url, resp.text, resp.status_code, hope, p=raw_params) return Response('post', url, resp.text, resp.status_code, hope, p=raw_params)
elif method == 'delete': elif method == 'delete':
resp = requests.delete(url) resp = requests.delete(url, verify=False)
return Response('delete', url, resp.text, resp.status_code, hope, p=raw_params) return Response('delete', url, resp.text, resp.status_code, hope, p=raw_params)
else: else:

15
json-api/ngninx.conf Normal file
View File

@ -0,0 +1,15 @@
server {
listen 80 default_server;
listen [::]:80 default_server;
# passing to json-api here
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# attempt to pass
proxy_pass http://0.0.0.0:4536;
#proxy_set_header: X-Real-IP $remote_addr;
}
}