Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Briar GTK
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
40
Issues
40
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
briar
Briar GTK
Commits
89bceb35
Commit
89bceb35
authored
Jun 06, 2019
by
Nico Alt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add unit tests with pytest
parent
1f991db7
Pipeline
#3499
failed with stage
in 3 minutes and 48 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
1 deletion
+51
-1
.gitignore
.gitignore
+1
-0
.gitlab-ci.yml
.gitlab-ci.yml
+14
-1
requirements-dev.txt
requirements-dev.txt
+2
-0
tests/briar/api/models/test_contacts.py
tests/briar/api/models/test_contacts.py
+30
-0
tools/run-tests.sh
tools/run-tests.sh
+1
-0
tools/tests/test-pytest.sh
tools/tests/test-pytest.sh
+3
-0
No files found.
.gitignore
View file @
89bceb35
builddir
builddir
.flatpak-builder
.flatpak-builder
__pycache__
.gitlab-ci.yml
View file @
89bceb35
test:
lints
:
test:
pycodestyle
:
image
:
debian:stretch
image
:
debian:stretch
script
:
script
:
-
apt update && apt install --no-install-recommends -y gir1.2-gtk-3.0 python3-gi python3-pip python3-setuptools
-
apt update && apt install --no-install-recommends -y gir1.2-gtk-3.0 python3-gi python3-pip python3-setuptools
-
pip3 install -r requirements-dev.txt
-
pip3 install -r requirements-dev.txt
-
tools/tests/test-pycodestyle.sh
-
tools/tests/test-pycodestyle.sh
test:pylint:
image
:
debian:stretch
script
:
-
apt update && apt install --no-install-recommends -y gir1.2-gtk-3.0 python3-gi python3-pip python3-setuptools
-
pip3 install -r requirements-dev.txt
-
tools/tests/test-pylint.sh
-
tools/tests/test-pylint.sh
test:pytest:
image
:
debian:stretch
script
:
-
apt update && apt install --no-install-recommends -y gir1.2-gtk-3.0 python3-gi python3-pip python3-setuptools
-
pip3 install -r requirements-dev.txt
-
tools/tests/test-pytest.sh
requirements-dev.txt
View file @
89bceb35
-r requirements.txt
-r requirements.txt
pycodestyle>=2.5.0
pycodestyle>=2.5.0
pylint>=2.3.1
pylint>=2.3.1
pytest>=4.6.2
requests_mock>=1.6.0
tests/briar/api/models/test_contacts.py
0 → 100644
View file @
89bceb35
# Copyright (c) 2019 Nico Alt
# SPDX-License-Identifier: AGPL-3.0-only
# License-Filename: LICENSE.md
import
json
import
requests_mock
from
unittest
import
mock
,
TestCase
from
briar.api.models.contacts
import
Contacts
class
TestContacts
(
TestCase
):
@
requests_mock
.
Mocker
()
def
test_get
(
self
,
requests_mock
):
api
=
mock
.
Mock
()
contacts
=
Contacts
(
api
)
response_mock
=
{}
response_mock
[
"author"
]
=
{}
response_mock
[
"author"
][
"formatVersion"
]
=
1
response_mock
[
"author"
][
"id"
]
=
"y1wkIzAimAbYoCGgWxkWlr6vnq1F8t1QRA/UMPgI0E0="
response_mock
[
"author"
][
"name"
]
=
"Test"
response_mock
[
"author"
][
"publicKey"
]
=
"BDu6h1S02bF4W6rgoZfZ6BMjTj/9S9hNN7EQoV05qUo="
response_mock
[
"contactId"
]
=
1
response_mock
[
"alias"
]
=
"A local nickname"
response_mock
[
"handshakePublicKey"
]
=
"XnYRd7a7E4CTqgAvh4hCxh/YZ0EPscxknB9ZcEOpSzY="
response_mock
[
"verified"
]
=
True
requests_mock
.
get
(
"http://localhost:7000/v1/contacts"
,
text
=
json
.
dumps
(
response_mock
))
self
.
assertEqual
(
contacts
.
get
(),
response_mock
)
tools/run-tests.sh
View file @
89bceb35
...
@@ -2,3 +2,4 @@
...
@@ -2,3 +2,4 @@
tools/tests/test-pycodestyle.sh
tools/tests/test-pycodestyle.sh
tools/tests/test-pylint.sh
tools/tests/test-pylint.sh
tools/tests/test-pytest.sh
tools/tests/test-pytest.sh
0 → 100755
View file @
89bceb35
#!/usr/bin/env bash
PYTHONPATH
=
src pytest tests/
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