Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Joakim Saario
aurweb
Commits
62e58b12
Commit
62e58b12
authored
Jun 04, 2021
by
Kevin Morris
Browse files
fix test_accounts_routes test coverage
Signed-off-by:
Kevin Morris
<
kevr@0cost.org
>
parent
228bc8fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
62e58b12
...
...
@@ -8,7 +8,7 @@ cache:
before_script
:
-
pacman -Syu --noconfirm --noprogressbar --needed --cachedir .pkg-cache
base-devel git gpgme protobuf pyalpm python-mysql
-connector
base-devel git gpgme protobuf pyalpm python-mysql
client
python-pygit2 python-srcinfo python-bleach python-markdown
python-sqlalchemy python-alembic python-pytest python-werkzeug
python-pytest-tap python-fastapi hypercorn nginx python-authlib
...
...
test/test_accounts_routes.py
View file @
62e58b12
...
...
@@ -30,6 +30,20 @@ client = TestClient(app)
user
=
None
def
make_ssh_pubkey
():
# Create a public key with ssh-keygen (this adds ssh-keygen as a
# dependency to passing this test).
with
tempfile
.
TemporaryDirectory
()
as
tmpdir
:
with
open
(
"/dev/null"
,
"w"
)
as
null
:
proc
=
Popen
([
"ssh-keygen"
,
"-f"
,
f
"
{
tmpdir
}
/test.ssh"
,
"-N"
,
""
],
stdout
=
null
,
stderr
=
null
)
proc
.
wait
()
assert
proc
.
returncode
==
0
# Read in the public key, then delete the temp dir we made.
return
open
(
f
"
{
tmpdir
}
/test.ssh.pub"
).
read
().
rstrip
()
@
pytest
.
fixture
(
autouse
=
True
)
def
setup
():
global
user
...
...
@@ -770,27 +784,13 @@ def test_post_account_edit_error_unauthorized():
def
test_post_account_edit_ssh_pub_key
():
pk
=
str
()
# Create a public key with ssh-keygen (this adds ssh-keygen as a
# dependency to passing this test).
with
tempfile
.
TemporaryDirectory
()
as
tmpdir
:
with
open
(
"/dev/null"
,
"w"
)
as
null
:
proc
=
Popen
([
"ssh-keygen"
,
"-f"
,
f
"
{
tmpdir
}
/test.ssh"
,
"-N"
,
""
],
stdout
=
null
,
stderr
=
null
)
proc
.
wait
()
assert
proc
.
returncode
==
0
# Read in the public key, then delete the temp dir we made.
pk
=
open
(
f
"
{
tmpdir
}
/test.ssh.pub"
).
read
().
rstrip
()
request
=
Request
()
sid
=
user
.
login
(
request
,
"testPassword"
)
post_data
=
{
"U"
:
"test"
,
"E"
:
"test@example.org"
,
"PK"
:
pk
,
"PK"
:
make_ssh_pubkey
()
,
"passwd"
:
"testPassword"
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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