Repository: freedomofpress/securedrop

Issue:
pylint: pylint rules should be refreshed and enforced in CI



Discussion:

Resolving patch:
diff --git a/securedrop/source_app/main.py b/securedrop/source_app/main.py
--- a/securedrop/source_app/main.py
+++ b/securedrop/source_app/main.py
@@ -217,7 +217,7 @@ def login():
                 return redirect(url_for('.lookup', from_login='1'))
             else:
                 current_app.logger.info(
-                        "Login failed for invalid codename".format(codename))
+                        "Login failed for invalid codename")
                 flash(gettext("Sorry, that is not a recognized codename."),
                       "error")
         return render_template('login.html', form=form)
diff --git a/securedrop/store.py b/securedrop/store.py
--- a/securedrop/store.py
+++ b/securedrop/store.py
@@ -6,7 +6,7 @@
 import crypto_util
 import tempfile
 import gzip
-from werkzeug import secure_filename
+from werkzeug.utils import secure_filename
 
 from secure_tempfile import SecureTemporaryFile
 


Test patch:
diff --git a/securedrop/tests/functional/journalist_navigation_steps.py b/securedrop/tests/functional/journalist_navigation_steps.py
--- a/securedrop/tests/functional/journalist_navigation_steps.py
+++ b/securedrop/tests/functional/journalist_navigation_steps.py
@@ -12,7 +12,7 @@
 from step_helpers import screenshots
 
 
-class JournalistNavigationSteps():
+class JournalistNavigationStepsMixin():
 
     @screenshots
     def _get_submission_content(self, file_url, raw_content):
@@ -334,9 +334,9 @@ def can_edit_user():
             'button[type=submit]')
         update_user_btn.click()
 
-        def can_edit_user():
+        def can_edit_user2():
             assert ('"{}"'.format(new_username) in self.driver.page_source)
-        self.wait_for(can_edit_user)
+        self.wait_for(can_edit_user2)
 
         # Update self.new_user with the new username for the future tests
         self.new_user['username'] = new_username
diff --git a/securedrop/tests/functional/make_account_changes.py b/securedrop/tests/functional/make_account_changes.py
--- a/securedrop/tests/functional/make_account_changes.py
+++ b/securedrop/tests/functional/make_account_changes.py
@@ -2,12 +2,12 @@
 from unittest import TestCase
 
 from functional_test import FunctionalTest
-from journalist_navigation_steps import JournalistNavigationSteps
+from journalist_navigation_steps import JournalistNavigationStepsMixin
 from step_helpers import screenshots
 
 
-class MakeAccountChanges(FunctionalTest, JournalistNavigationSteps, TestCase):
-
+class MakeAccountChanges(FunctionalTest, JournalistNavigationStepsMixin,
+                         TestCase):
     @screenshots
     def test_admin_edit_account_html_template_rendering(self):
         """The edit_account.html template is used both when an admin is editing
diff --git a/securedrop/tests/functional/source_navigation_steps.py b/securedrop/tests/functional/source_navigation_steps.py
--- a/securedrop/tests/functional/source_navigation_steps.py
+++ b/securedrop/tests/functional/source_navigation_steps.py
@@ -5,7 +5,7 @@
 from step_helpers import screenshots
 
 
-class SourceNavigationSteps():
+class SourceNavigationStepsMixin():
 
     @screenshots
     def _source_visits_source_homepage(self):
diff --git a/securedrop/tests/functional/test_admin_interface.py b/securedrop/tests/functional/test_admin_interface.py
--- a/securedrop/tests/functional/test_admin_interface.py
+++ b/securedrop/tests/functional/test_admin_interface.py
@@ -5,7 +5,7 @@
 
 class TestAdminInterface(
         functional_test.FunctionalTest,
-        journalist_navigation_steps.JournalistNavigationSteps):
+        journalist_navigation_steps.JournalistNavigationStepsMixin):
 
     @screenshots
     def test_admin_interface(self):
diff --git a/securedrop/tests/functional/test_journalist.py b/securedrop/tests/functional/test_journalist.py
--- a/securedrop/tests/functional/test_journalist.py
+++ b/securedrop/tests/functional/test_journalist.py
@@ -22,8 +22,8 @@
 
 class TestJournalist(
         functional_test.FunctionalTest,
-        source_navigation_steps.SourceNavigationSteps,
-        journalist_navigation_steps.JournalistNavigationSteps):
+        source_navigation_steps.SourceNavigationStepsMixin,
+        journalist_navigation_steps.JournalistNavigationStepsMixin):
 
     def test_journalist_verifies_deletion_of_one_submission_javascript(self):
         self._source_visits_source_homepage()
diff --git a/securedrop/tests/functional/test_source.py b/securedrop/tests/functional/test_source.py
--- a/securedrop/tests/functional/test_source.py
+++ b/securedrop/tests/functional/test_source.py
@@ -4,7 +4,7 @@
 
 class TestSourceInterface(
         functional_test.FunctionalTest,
-        source_navigation_steps.SourceNavigationSteps):
+        source_navigation_steps.SourceNavigationStepsMixin):
 
     def test_lookup_codename_hint(self):
         self._source_visits_source_homepage()
diff --git a/securedrop/tests/functional/test_source_notfound.py b/securedrop/tests/functional/test_source_notfound.py
--- a/securedrop/tests/functional/test_source_notfound.py
+++ b/securedrop/tests/functional/test_source_notfound.py
@@ -4,7 +4,7 @@
 
 class TestSourceInterfaceNotFound(
         functional_test.FunctionalTest,
-        source_navigation_steps.SourceNavigationSteps):
+        source_navigation_steps.SourceNavigationStepsMixin):
 
     def test_not_found(self):
         self._source_not_found()
diff --git a/securedrop/tests/functional/test_source_session_timeout.py b/securedrop/tests/functional/test_source_session_timeout.py
--- a/securedrop/tests/functional/test_source_session_timeout.py
+++ b/securedrop/tests/functional/test_source_session_timeout.py
@@ -4,7 +4,7 @@
 
 class TestSourceSessions(
         functional_test.FunctionalTest,
-        source_navigation_steps.SourceNavigationSteps):
+        source_navigation_steps.SourceNavigationStepsMixin):
 
     def setup(self):
         # The session expiration here cannot be set to -1
diff --git a/securedrop/tests/functional/test_source_warnings.py b/securedrop/tests/functional/test_source_warnings.py
--- a/securedrop/tests/functional/test_source_warnings.py
+++ b/securedrop/tests/functional/test_source_warnings.py
@@ -4,7 +4,7 @@
 
 class TestSourceInterfaceBannerWarnings(
         functional_test.FunctionalTest,
-        source_navigation_steps.SourceNavigationSteps):
+        source_navigation_steps.SourceNavigationStepsMixin):
 
     def test_warning_appears_if_tor_browser_not_in_use(self):
         self.driver.get(self.source_location)
diff --git a/securedrop/tests/functional/test_submission_not_in_memory.py b/securedrop/tests/functional/test_submission_not_in_memory.py
--- a/securedrop/tests/functional/test_submission_not_in_memory.py
+++ b/securedrop/tests/functional/test_submission_not_in_memory.py
@@ -1,6 +1,6 @@
 from functional_test import FunctionalTest
 import subprocess
-from source_navigation_steps import SourceNavigationSteps
+from source_navigation_steps import SourceNavigationStepsMixin
 import os
 import pytest
 import getpass
@@ -8,7 +8,7 @@
 
 
 class TestSubmissionNotInMemory(FunctionalTest,
-                                SourceNavigationSteps):
+                                SourceNavigationStepsMixin):
 
     def setup(self):
         self.devnull = open('/dev/null', 'r')
diff --git a/securedrop/tests/functional/test_submit_and_retrieve_file.py b/securedrop/tests/functional/test_submit_and_retrieve_file.py
--- a/securedrop/tests/functional/test_submit_and_retrieve_file.py
+++ b/securedrop/tests/functional/test_submit_and_retrieve_file.py
@@ -6,8 +6,8 @@
 
 class TestSubmitAndRetrieveFile(
         functional_test.FunctionalTest,
-        source_navigation_steps.SourceNavigationSteps,
-        journalist_navigation_steps.JournalistNavigationSteps):
+        source_navigation_steps.SourceNavigationStepsMixin,
+        journalist_navigation_steps.JournalistNavigationStepsMixin):
 
     @screenshots
     def test_submit_and_retrieve_happy_path(self):
diff --git a/securedrop/tests/functional/test_submit_and_retrieve_message.py b/securedrop/tests/functional/test_submit_and_retrieve_message.py
--- a/securedrop/tests/functional/test_submit_and_retrieve_message.py
+++ b/securedrop/tests/functional/test_submit_and_retrieve_message.py
@@ -6,8 +6,8 @@
 
 class TestSubmitAndRetrieveMessage(
         functional_test.FunctionalTest,
-        source_navigation_steps.SourceNavigationSteps,
-        journalist_navigation_steps.JournalistNavigationSteps):
+        source_navigation_steps.SourceNavigationStepsMixin,
+        journalist_navigation_steps.JournalistNavigationStepsMixin):
 
     @screenshots
     def test_submit_and_retrieve_happy_path(self):
diff --git a/securedrop/tests/i18n/code.py b/securedrop/tests/i18n/code.py
--- a/securedrop/tests/i18n/code.py
+++ b/securedrop/tests/i18n/code.py
@@ -1,2 +1,4 @@
 # -*- coding: utf-8 -*-
+from flask_babel import gettext
+
 print(gettext('code hello i18n'))
diff --git a/securedrop/tests/pages-layout/test_journalist.py b/securedrop/tests/pages-layout/test_journalist.py
--- a/securedrop/tests/pages-layout/test_journalist.py
+++ b/securedrop/tests/pages-layout/test_journalist.py
@@ -36,8 +36,8 @@ def finalizer():
 @pytest.mark.pagelayout
 class TestJournalistLayout(
         functional_test.FunctionalTest,
-        source_navigation_steps.SourceNavigationSteps,
-        journalist_navigation_steps.JournalistNavigationSteps):
+        source_navigation_steps.SourceNavigationStepsMixin,
+        journalist_navigation_steps.JournalistNavigationStepsMixin):
 
     def test_account_edit_hotp_secret(self):
         self._journalist_logs_in()
diff --git a/securedrop/tests/pages-layout/test_source.py b/securedrop/tests/pages-layout/test_source.py
--- a/securedrop/tests/pages-layout/test_source.py
+++ b/securedrop/tests/pages-layout/test_source.py
@@ -24,8 +24,8 @@
 @pytest.mark.pagelayout
 class TestSourceLayout(
         functional_test.FunctionalTest,
-        source_navigation_steps.SourceNavigationSteps,
-        journalist_navigation_steps.JournalistNavigationSteps):
+        source_navigation_steps.SourceNavigationStepsMixin,
+        journalist_navigation_steps.JournalistNavigationStepsMixin):
 
     def test_index(self):
         self._source_visits_source_homepage()
@@ -141,8 +141,8 @@ def test_why_journalist_key(self):
 @pytest.mark.pagelayout
 class TestSourceSessionLayout(
         functional_test.FunctionalTest,
-        source_navigation_steps.SourceNavigationSteps,
-        journalist_navigation_steps.JournalistNavigationSteps):
+        source_navigation_steps.SourceNavigationStepsMixin,
+        journalist_navigation_steps.JournalistNavigationStepsMixin):
 
     def setup(self):
         self.session_length_minutes = 0.03