Skip to content

Commit cd6d0a1

Browse files
authored
Add Github workflow for unit tests (fixes #180) (#185)
* Add Github workflow for unit tests (#180) * Install wheel * Install gettext * Try with itstool * Try libappstream-glib-dev * Try intltool * ... * Try 18.04 * Try insalling from Nick's PR branch * Fix test * Fix test? * Try fixing flaky test * Aother try
1 parent 18e5fd4 commit cd6d0a1

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

.github/workflows/test.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: unit tests
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-18.04
12+
strategy:
13+
matrix:
14+
python-version: [3.6, 3.7, 3.8, 3.9]
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Set up Python ${{ matrix.python-version }}
18+
uses: actions/setup-python@v2
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
- name: Install Ubuntu dependencies
22+
run: sudo apt-get -y install gettext appstream pkg-config libcairo2-dev gir1.2-gtk-3.0 libgirepository1.0-dev libicu-dev
23+
- name: Install Python dependencies
24+
run: |
25+
python -m pip install --upgrade pip wheel
26+
pip install pycairo PyGObject pytest PyYAML jsonschema pyICU
27+
python -m pip install git+https://github.com/Nick-Hall/gramps@tests#egg=gramps
28+
pip install .
29+
pip list
30+
- name: Test with pytest
31+
run: |
32+
pytest

tests/test_endpoints/test_user.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ def test_reset_password(self):
183183
matches = re.findall(r".*jwt=([^\s]+).*", body)
184184
self.assertEqual(len(matches), 1, msg=body)
185185
token = matches[0]
186+
if token[:2] == "3D":
187+
token = token[2:]
186188
# try without token!
187189
rv = self.client.post(
188190
BASE_URL + "/users/-/password/reset/", json={"new_password": "789"},
@@ -194,7 +196,7 @@ def test_reset_password(self):
194196
headers={"Authorization": "Bearer {}".format(token)},
195197
json={"new_password": ""},
196198
)
197-
self.assertEqual(rv.status_code, 400)
199+
self.assertEqual(rv.status_code, 400, msg="Invalid token: {}".format(token))
198200
# now that should work
199201
rv = self.client.post(
200202
BASE_URL + "/users/-/password/reset/",

0 commit comments

Comments
 (0)