Skip to content

Commit

Permalink
fix: fix TestOTLViews tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mutantsan committed Oct 4, 2023
1 parent 4bde123 commit 49db461
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
1 change: 1 addition & 0 deletions ckanext/let_me_in/tests/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from ckan.tests.helpers import call_auth


@pytest.mark.usefixtures("non_clean_db", "with_plugins")
class TestGenerateOTLAuth:
def test_anon(self):
with pytest.raises(tk.NotAuthorized):
Expand Down
11 changes: 4 additions & 7 deletions ckanext/let_me_in/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,16 @@
from ckan.tests.helpers import call_action


@pytest.mark.usefixtures("non_clean_db")
@pytest.mark.usefixtures("non_clean_db", "with_plugins")
class TestOTLViews(object):
def test_login_user_with_otl(self, app, user):
otl = call_action("lmi_generate_otl", uid=user["id"])

result = app.get(otl["url"], status=200)
assert "You have been logged in" in result.text
assert "You have been logged in" in app.get(otl["url"]).body

result = app.get(otl["url"], status=200)
assert (
"You have tried to use a one-time login link that has expired"
in result.text
in app.get(otl["url"]).body
)

def test_user_login_expires_the_otl(self, app, user):
Expand All @@ -31,8 +29,7 @@ def test_user_login_expires_the_otl(self, app, user):
user = cast(model.User, model.User.get(user["id"]))
user.set_user_last_active()

result = app.get(otl["url"], status=200)
assert (
"You have tried to use a one-time login link that has expired"
in result.text
in app.get(otl["url"]).body
)

0 comments on commit 49db461

Please sign in to comment.