various #16

Merged
dan merged 94 commits from various into dev 2023-12-14 14:04:01 +01:00
2 changed files with 13 additions and 7 deletions
Showing only changes of commit 2f6d0c47e5 - Show all commits

10
main.py
View file

@ -1,16 +1,12 @@
import json
import os
import subprocess
from pathlib import Path
from pytest_abra.utils import load_json_to_environ
# --------------------- load credentials to env variables -------------------- #
cred_file = Path("credentials.json")
with open(cred_file, "r") as f:
CREDENTIALS = json.load(f)
for key, value in CREDENTIALS.items():
os.environ[key] = value
load_json_to_environ(cred_file)
# --------------------------------- env files -------------------------------- #

View file

@ -1,3 +1,5 @@
import json
import os
import random
import string
from dataclasses import dataclass
@ -46,3 +48,11 @@ def generate_random_string(length: int, punctuation=False) -> str:
characters += string.punctuation
random_string = "".join(random.choice(characters) for _ in range(length))
return random_string
def load_json_to_environ(cred_file: Path):
with open(cred_file, "r") as f:
CREDENTIALS = json.load(f)
for key, value in CREDENTIALS.items():
os.environ[key] = value