mirror of
https://github.com/creyD/creyPY.git
synced 2026-04-12 19:30:30 +02:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
be260b0ee6 | ||
|
|
b0f2815568 | ||
|
|
6ac609f3f4 | ||
|
|
53ed939451 | ||
| c56d14c2fd | |||
|
|
1e9bcb92b6 | ||
| 5e16bd5cbc | |||
|
|
50b444be89 | ||
| e12c86e352 | |||
|
|
0708a48301 | ||
| 34595d52f2 | |||
|
|
421725ad10 |
@@ -1,3 +1,8 @@
|
||||
from .async_session import * # noqa
|
||||
from .helpers import * # noqa
|
||||
from .session import * # noqa
|
||||
try:
|
||||
import sqlalchemy
|
||||
|
||||
from .async_session import *
|
||||
from .helpers import *
|
||||
from .session import *
|
||||
except ImportError:
|
||||
print("SQLAlchemy not installed. Database functionality will be disabled.")
|
||||
|
||||
@@ -140,6 +140,7 @@ class AbstractTestAPI(unittest.IsolatedAsyncioTestCase):
|
||||
pagination: bool = True,
|
||||
id_field: str = "id",
|
||||
created_at_check: bool = True,
|
||||
patch: dict | None = None,
|
||||
):
|
||||
# GET LIST
|
||||
re = await self.get(url)
|
||||
@@ -164,6 +165,14 @@ class AbstractTestAPI(unittest.IsolatedAsyncioTestCase):
|
||||
re = await self.get(f"{url}{obj_id}/")
|
||||
self.assertEqual(re[id_field], obj_id)
|
||||
|
||||
# PATCH
|
||||
if patch:
|
||||
for key, value in patch.items():
|
||||
input_obj[key] = value
|
||||
re = await self.patch(f"{url}{obj_id}/", obj=input_obj)
|
||||
for key, value in patch.items():
|
||||
self.assertEqual(re[key], value)
|
||||
|
||||
# GET LIST
|
||||
re = await self.get(url)
|
||||
if pagination:
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import secrets
|
||||
import string
|
||||
import csv
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def create_random_password(length: int = 12) -> str:
|
||||
@@ -14,3 +16,11 @@ def create_random_password(length: int = 12) -> str:
|
||||
password += [secrets.choice(all_characters) for _ in range(length - 4)]
|
||||
secrets.SystemRandom().shuffle(password)
|
||||
return "".join(password)
|
||||
|
||||
|
||||
def data_to_csv(file: Path, data: list) -> None:
|
||||
|
||||
with file.open(mode="w", newline="", encoding="utf-8") as f:
|
||||
writer = csv.DictWriter(f, fieldnames=data[0].keys(), delimiter=";")
|
||||
writer.writeheader()
|
||||
writer.writerows(data)
|
||||
|
||||
@@ -101,7 +101,7 @@ def request_verification_mail(sub: str) -> None:
|
||||
return re.json()
|
||||
|
||||
|
||||
def create_user_invite(email: str) -> dict:
|
||||
def create_user_invite(email: str, company_id: str) -> dict:
|
||||
re = requests.post(
|
||||
f"https://{AUTH0_DOMAIN}/api/v2/users",
|
||||
headers={"Authorization": f"Bearer {get_management_token()}"},
|
||||
@@ -111,6 +111,7 @@ def create_user_invite(email: str) -> dict:
|
||||
"password": create_random_password(),
|
||||
"verify_email": False,
|
||||
"app_metadata": {"invitedToMyApp": True},
|
||||
"user_metadata": {"company_ids": [company_id]},
|
||||
},
|
||||
timeout=5,
|
||||
)
|
||||
|
||||
@@ -1 +1 @@
|
||||
stripe==11.4.1 # Stripe
|
||||
stripe==11.6.0 # Stripe
|
||||
|
||||
Reference in New Issue
Block a user