Commit 9101454f authored by satan's avatar satan
Browse files

test: move tests into module to be able to import it

parent f8fb02fe
import json
from pathlib import Path
from rich import print, inspect
from topicmanager.gitlab_project import GitlabProject
def init():
json_path = Path(__file__).parent / "config.json"
config = json.loads(json_path.read_text())
glp = GitlabProject(
url=config["gitlab"]["url"],
token=config["gitlab"]["token"],
project_id=int(config["gitlab"]["project_id"]),
translator_key=config["deepl"]["token"],
)
return glp
if __name__ == "__main__":
glp = init()
inspect(glp.project.issues.list()[0])
import json
from pathlib import Path
from functools import cache
from rich import print, inspect
from topicmanager.gitlab_project import GitlabProject
@cache
def init():
config_path = Path(__file__).parent / "config.json"
config = json.loads(config_path.read_text())
glp = GitlabProject(
url=config["gitlab"]["url"],
token=config["gitlab"]["token"],
project_id=config["gitlab"]["project_id"],
translator_key=config["deepl"]["token"],
)
return glp
def test_init():
glp = init()
assert isinstance(glp, GitlabProject)
def test_read_issues():
pass
def test_modify_issue():
pass
def test_write_issue_note():
pass
def test_create_issue():
pass
{
"gitlab": {
"url": "https://gitlab.fem-net.de",
"token": "Xn4DEC1EFM1AChGaar-X",
"token": "xxx",
"project_id": 138,
"board_id": 81
},
......
......@@ -3,9 +3,7 @@ from pathlib import Path
from functools import cache
from rich import print, inspect
import topicmanager.mail as mail
# Tests will fail due to incomplete config.json
from ..mail import Mail
@cache
......@@ -13,19 +11,20 @@ def init():
config_path = Path(__file__).parent / "config.json"
config = json.loads(config_path.read_text())
m = mail.Mail(**config["mail"])
m = Mail(**config["mail"])
return m
def test_init():
m = init()
assert isinstance(m, mail.Mail)
assert isinstance(m, Mail)
def test_send_mail():
m = init()
m.send_mail("content", "subject")
# TODO: mock smtp to test send_mail
# m.send_mail("content", "subject")
def test_reply_to():
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment