Implement source testing framework + Slack (#2650)

* Added permission sync tests for Slack

* moved folders

* prune test + mypy

* added wait for indexing to cc_pair creation

* commented out check

* should fix other tests

* added slack channel pool

* fixed everything and mypy

* reduced flake
This commit is contained in:
hagen-danswer
2024-10-02 16:16:07 -07:00
committed by GitHub
parent b3c367d09c
commit c2088602e1
15 changed files with 1098 additions and 63 deletions

View File

@@ -17,11 +17,14 @@ class UserManager:
@staticmethod
def create(
name: str | None = None,
email: str | None = None,
) -> DATestUser:
if name is None:
name = f"test{str(uuid4())}"
email = f"{name}@test.com"
if email is None:
email = f"{name}@test.com"
password = "test"
body = {
@@ -44,12 +47,10 @@ class UserManager:
)
print(f"Created user {test_user.email}")
test_user.headers["Cookie"] = UserManager.login_as_user(test_user)
return test_user
return UserManager.login_as_user(test_user)
@staticmethod
def login_as_user(test_user: DATestUser) -> str:
def login_as_user(test_user: DATestUser) -> DATestUser:
data = urlencode(
{
"username": test_user.email,
@@ -71,7 +72,9 @@ class UserManager:
raise Exception("Failed to login")
print(f"Logged in as {test_user.email}")
return f"{result_cookie.name}={result_cookie.value}"
cookie = f"{result_cookie.name}={result_cookie.value}"
test_user.headers["Cookie"] = cookie
return test_user
@staticmethod
def verify_role(user_to_verify: DATestUser, target_role: UserRole) -> bool: