create_admin flag now behaves correctly

This commit is contained in:
shockrah 2020-11-21 19:04:06 -08:00
parent 1c1bb5f3cd
commit acbbaab68d

View File

@ -21,7 +21,7 @@ class Test:
self.test_count = 0
if create_admin:
self.body = Test.__create_admin() #this was an afterthough for pipelines(later not now)
self.body = Test.__create_admin()
elif admin is not None:
self.body = body
else:
@ -38,13 +38,19 @@ class Test:
self.base = base
@staticmethod
def __create_admin(cargo_path: str):
def __create_admin():
# /home/$user/.cargo/bin/cargo <- normally
# prolly some awful shit on pipes
CARGO_BIN = os.getenv(cargo_path)
raw_json = subprocess.run(f'{CARGO_BIN} run --release -- -c dev-test'.split(), text=True, capture_output=True)
#raw_json = raw_json_b[2:-1].replace('\\n', ' ').strip()
return json.loads(raw_json.stdout)
CARGO_BIN = os.getenv('CARGO_BIN')
proc = subprocess.run(f'{CARGO_BIN} run --release -- -c dev-test'.split(), text=True, capture_output=True)
try:
return json.loads(proc.stdout)
except:
import sys
print('UNABLE TO LOAD JSON DATA FROM -c flag', file=sys.stderr)
exit(1)
@staticmethod
@ -94,8 +100,7 @@ class Test:
if __name__ == '__main__':
worker = Test(create_admin=False)
worker = Test(create_admin=True)
# First the invites api gets some basic tests
worker.get('/invite/create')