* general project refactoring * various small improvements * improve imap fixture with helper functions and typing * add wordpress send email setup * add wordpress receive email test * add various documentation Reviewed-on: local-it-infrastructure/e2e_tests#13 Co-authored-by: Daniel <d.brummerloh@gmail.com> Co-committed-by: Daniel <d.brummerloh@gmail.com>
37 lines
886 B
Python
37 lines
886 B
Python
from dataclasses import dataclass
|
|
from datetime import datetime
|
|
from pathlib import Path
|
|
from urllib.parse import urlunparse
|
|
|
|
|
|
@dataclass
|
|
class BaseUrl:
|
|
"""utility class to create a url string with urllib"""
|
|
|
|
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_datetime_string() -> 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()
|