IEEE.org
|
IEEE Xplore Digital Library
|
IEEE Standards
|
IEEE Spectrum
|
More Sites
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Bit Borealis
Mystic
Commits
7f183cf1
Commit
7f183cf1
authored
Jun 09, 2021
by
Bit Borealis
Browse files
Merge branch 'main' into dev
parents
b1b2e51d
ece31abe
Pipeline
#104
failed with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
mystic/tests/test_database.py
View file @
7f183cf1
...
...
@@ -43,10 +43,12 @@ def project(projects: Callable[[str], Project]) -> Iterator[Project]:
@
fixture
def
users
(
database
:
Cursor
)
->
Iterator
[
Callable
[[
str
],
User
]]:
ids
:
List
[
int
]
=
[]
def
new_user
(
username
:
str
)
->
User
:
def
new_user
(
username
:
str
,
name
:
str
=
None
)
->
User
:
if
name
is
None
:
name
=
username
database
.
execute
(
"""
INSERT INTO users(username) VALUES (?);
"""
,
(
username
,))
INSERT INTO users(username
, name
) VALUES (
?,
?);
"""
,
(
username
,
name
))
uid
=
database
.
lastrowid
ids
.
append
(
uid
)
return
User
(
database
,
uid
)
...
...
@@ -331,12 +333,12 @@ class TestUser:
assert
source_set
==
{
sources
[
0
],
sources
[
1
],
sources
[
4
],
sources
[
5
]}
def
test_create_project
(
self
,
database
:
Cursor
)
->
None
:
u
=
User
.
create_user
(
database
,
"alch_emi"
)
u
=
User
.
create_user
(
database
,
1312
,
"alch_emi"
,
"Emi"
)
record
=
database
.
execute
(
"""
SELECT * FROM users WHERE user_id = ?;
"""
,
(
u
.
user_id
,))
assert
next
(
record
)
==
(
u
.
user_id
,
"alch_emi"
)
assert
next
(
record
)
==
(
1312
,
"alch_emi"
,
"Emi"
)
database
.
execute
(
"""
DELETE FROM users WHERE user_id = ?;
...
...
Write
Preview
Markdown
is supported
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