* make it so that the actual tests can be moved anywhere, for example in abra recipe repos -> major refactoring with pytest test discovery magic * create RUNNER_DICT dynamically with importlib -> none of the tests are hardcoded, more tests can be added by placing a folder * autoload fixtures with pytest plugins * add URL fixture to navigate on web pages. Includes url parser based on python urllib to generate correct links * fix nextcloud setups and tests * add email groundwork with imbox Reviewed-on: local-it-infrastructure/e2e_tests#7 Co-authored-by: Daniel <d.brummerloh@gmail.com> Co-committed-by: Daniel <d.brummerloh@gmail.com>
40 lines
942 B
Python
40 lines
942 B
Python
from dataclasses import dataclass
|
|
from datetime import datetime
|
|
from pathlib import Path
|
|
from urllib.parse import urlunparse
|
|
|
|
|
|
@dataclass
|
|
class BaseUrl:
|
|
netloc: str
|
|
scheme: str = "https"
|
|
path: str = ""
|
|
params: str = ""
|
|
query: str = ""
|
|
fragment: str = ""
|
|
|
|
def get(self, path: str = ""):
|
|
return urlunparse((self.scheme, self.netloc, path, self.params, self.query, self.fragment))
|
|
|
|
|
|
def get_session_id() -> str:
|
|
current_datetime = datetime.now()
|
|
return current_datetime.strftime("%Y-%m-%d-%H-%M-%S")
|
|
|
|
|
|
def rmtree(root_dir: Path):
|
|
"""removes a folder with content recursively"""
|
|
if not root_dir.is_dir():
|
|
return
|
|
for child in root_dir.iterdir():
|
|
if child.is_dir():
|
|
rmtree(child)
|
|
else:
|
|
child.unlink()
|
|
|
|
root_dir.rmdir()
|
|
|
|
|
|
def make_url(domain: str) -> str:
|
|
"""adds 'http://' at the beginning of a string"""
|
|
return "https://" + domain
|