Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Technik
topicmanager
Commits
9101454f
Commit
9101454f
authored
Feb 15, 2022
by
satan
Browse files
test: move tests into module to be able to import it
parent
f8fb02fe
Changes
7
Hide whitespace changes
Inline
Side-by-side
tests/playground.py
deleted
100644 → 0
View file @
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
])
tests/test_gitlab_project.py
deleted
100644 → 0
View file @
f8fb02fe
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
topicmanager/test/__init__.py
0 → 100644
View file @
9101454f
test
s
/config.json
→
topicmanager/
test/config.json
View file @
9101454f
{
"gitlab"
:
{
"url"
:
"https://gitlab.fem-net.de"
,
"token"
:
"
Xn4DEC1EFM1AChGaar-X
"
,
"token"
:
"
xxx
"
,
"project_id"
:
138
,
"board_id"
:
81
},
...
...
test
s
/mail_template_invite.txt
→
topicmanager/
test/mail_template_invite.txt
View file @
9101454f
File moved
test
s
/mail_template_protocol.txt
→
topicmanager/
test/mail_template_protocol.txt
View file @
9101454f
File moved
test
s
/test_mail.py
→
topicmanager/
test/test_mail.py
View file @
9101454f
...
...
@@ -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
():
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment