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