New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assertions are not evaluated in some functional tests #5607
Comments
A quick search shows 24 occurrences of the
Replacing the guard clause with
|
I think @DrGFreeman you also found another functional test error, the message |
|
@eloquence, I can take care of this one if it's OK with the team. |
@DrGFreeman That would be awesome, thank you :) |
Replace guard clause to ensure assertions are evaluated when running functional tests (ref. freedomofpress#5607).
Description
Functional tests using navigation steps in which the
assert
statement is behind theif not hasattr(self, "accept_languages"):
guard clause always pass regardless of the assertion result.Steps to Reproduce
Replace the
assert
statement on line 168 below withassert False
.securedrop/securedrop/tests/functional/journalist_navigation_steps.py
Lines 162 to 170 in 8c86e8e
Run the test in the dev container with
make test
orsecuredrop/bin/dev-shell bin/run-test -v -x tests/functional/test_journalist.py::TestJournalist
Expected Behavior
tests/functional/test_journalist.py::TestJournalist::test_journalist_verifies_deletion_of_one_submission_modal
is expected to fail.Actual Behavior
tests/functional/test_journalist.py::TestJournalist::test_journalist_verifies_deletion_of_one_submission_modal
passes.Comments
The
FunctionalTest
class from which all functional test classes inherit hasaccept_languages = None
as default and this attribute is not modified except for the tests intests/pageslayout
. Theif not hasattr(self, "accept_languages"):
guard clause therefore always evaluates toFalse
and the assertion is not executed.I believe the guard clause could be changed to
if self.accept_languages is None:
so the assertions are evaluated during the functional tests and skipped in the page layout tests.The text was updated successfully, but these errors were encountered: