-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
679051f
commit 4d5680a
Showing
14 changed files
with
122 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,8 +42,8 @@ def setUp(self): | |
def test_default_config(self): | ||
"""Assert when no configuration is provided, :data:`anitya.config.config` is used.""" | ||
application = app.create() | ||
for key in anitya_config: | ||
self.assertEqual(anitya_config[key], application.config[key]) | ||
for key, value in anitya_config.items(): | ||
self.assertEqual(value, application.config[key]) | ||
|
||
def test_email_config(self): | ||
"""Assert a SMTPHandler is added to the anitya logger when ``EMAIL_ERRORS=True``.""" | ||
|
@@ -76,8 +76,10 @@ def test_db_config(self): | |
|
||
|
||
class IntegrityErrorHandlerTests(base.DatabaseTestCase): | ||
"""IntegrityErrorHandlerTests""" | ||
|
||
def setUp(self): | ||
super(IntegrityErrorHandlerTests, self).setUp() | ||
super().setUp() | ||
session = Session() | ||
self.user = models.User(email="[email protected]", username="user") | ||
session.add(self.user) | ||
|
@@ -129,8 +131,10 @@ def test_no_social_auth(self): | |
|
||
|
||
class AuthExceptionHandlerTests(base.DatabaseTestCase): | ||
def setUp(self): | ||
super(AuthExceptionHandlerTests, self).setUp() | ||
"""AuthExceptionHandlerTests""" | ||
|
||
def setUp(self): # pylint: disable=W0246 | ||
super().setUp() | ||
|
||
def test_exception_handling(self): | ||
"""Assert an AuthException results in a 400 error""" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,7 @@ class LoadUserFromRequestTests(DatabaseTestCase): | |
"""Tests for the :class:`anitya.authentication.SessionInterface`` class.""" | ||
|
||
def setUp(self): | ||
super(LoadUserFromRequestTests, self).setUp() | ||
super().setUp() | ||
self.app = self.flask_app.test_client() | ||
session = Session() | ||
self.user = models.User(email="[email protected]", username="user") | ||
|
@@ -78,7 +78,7 @@ class LoadUserFromSessionTests(DatabaseTestCase): | |
"""Tests for the :func:`anitya.authentication.load_user_from_session`` functions.""" | ||
|
||
def setUp(self): | ||
super(LoadUserFromSessionTests, self).setUp() | ||
super().setUp() | ||
|
||
session = Session() | ||
self.user = models.User(email="[email protected]", username="user") | ||
|
@@ -110,7 +110,7 @@ class RequireTokenTests(DatabaseTestCase): | |
"""Tests for the :func:`anitya.authentication.require_token` decorator.""" | ||
|
||
def setUp(self): | ||
super(RequireTokenTests, self).setUp() | ||
super().setUp() | ||
self.app = self.flask_app.test_client() | ||
session = Session() | ||
self.user = models.User(email="[email protected]", username="user") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,9 +56,11 @@ def test_session_removed_post_request(self): | |
|
||
|
||
class SettingsTests(DatabaseTestCase): | ||
"""SettingsTests""" | ||
|
||
def setUp(self): | ||
"""Set up the Flask testing environnment""" | ||
super(SettingsTests, self).setUp() | ||
super().setUp() | ||
self.app = self.flask_app.test_client() | ||
self.user = models.User(email="[email protected]", username="user") | ||
user_social_auth = social_models.UserSocialAuth( | ||
|
@@ -124,7 +126,7 @@ def test_delete_token(self): | |
data = {"csrf_token": csrf_token} | ||
|
||
output = c.post( | ||
"/settings/tokens/delete/{}/".format(token.token), | ||
f"/settings/tokens/delete/{token.token}/", | ||
data=data, | ||
follow_redirects=True, | ||
) | ||
|
@@ -165,7 +167,7 @@ def test_delete_token_invalid_csrf(self): | |
data = {"csrf_token": "not a valid token"} | ||
|
||
output = c.post( | ||
"/settings/tokens/delete/{}/".format(token.token), | ||
f"/settings/tokens/delete/{token.token}/", | ||
data=data, | ||
follow_redirects=True, | ||
) | ||
|
@@ -181,7 +183,7 @@ class NewProjectTests(DatabaseTestCase): | |
|
||
def setUp(self): | ||
"""Set up the Flask testing environnment""" | ||
super(NewProjectTests, self).setUp() | ||
super().setUp() | ||
create_distro(self.session) | ||
self.app = self.flask_app.test_client() | ||
self.user = models.User(email="[email protected]", username="user") | ||
|
@@ -321,6 +323,7 @@ def test_new_project_invalid_homepage(self): | |
|
||
@mock.patch("anitya.lib.utilities.check_project_release") | ||
def test_new_project_with_check_release(self, patched): | ||
"""test_new_project_with_check_release""" | ||
output = self.app.get("/project/new", follow_redirects=True) | ||
with login_user(self.flask_app, self.user): | ||
with self.flask_app.test_client() as c: | ||
|
@@ -441,7 +444,7 @@ class FlaskTest(DatabaseTestCase): | |
|
||
def setUp(self): | ||
"""Set up the environnment, ran before every tests.""" | ||
super(FlaskTest, self).setUp() | ||
super().setUp() | ||
|
||
self.flask_app.config["TESTING"] = True | ||
self.app = self.flask_app.test_client() | ||
|
@@ -830,9 +833,11 @@ def test_projects_updated_incorrect_status(self): | |
|
||
|
||
class EditProjectTests(DatabaseTestCase): | ||
"""EditProjectTests""" | ||
|
||
def setUp(self): | ||
"""Set up the Flask testing environnment""" | ||
super(EditProjectTests, self).setUp() | ||
super().setUp() | ||
self.app = self.flask_app.test_client() | ||
# Make a user to login with | ||
self.user = models.User(email="[email protected]", username="user") | ||
|
@@ -1012,7 +1017,7 @@ class MapProjectTests(DatabaseTestCase): | |
"""Tests for the :func:`anitya.ui.map_project` view.""" | ||
|
||
def setUp(self): | ||
super(MapProjectTests, self).setUp() | ||
super().setUp() | ||
create_distro(self.session) | ||
create_project(self.session) | ||
self.client = self.flask_app.test_client() | ||
|
@@ -1120,7 +1125,7 @@ class EditProjectMappingTests(DatabaseTestCase): | |
"""Tests for the :func:`anitya.ui.edit_project_mapping` view.""" | ||
|
||
def setUp(self): | ||
super(EditProjectMappingTests, self).setUp() | ||
super().setUp() | ||
|
||
# Set up a mapping to edit | ||
session = Session() | ||
|
@@ -1283,7 +1288,7 @@ class AddDistroTests(DatabaseTestCase): | |
"""Tests for the :func:`anitya.admin.add_distro` view function.""" | ||
|
||
def setUp(self): | ||
super(AddDistroTests, self).setUp() | ||
super().setUp() | ||
|
||
# Add a regular user and an admin user | ||
session = Session() | ||
|
@@ -1365,7 +1370,7 @@ class FlagProjecTests(DatabaseTestCase): | |
"""Tests for the :func:`anitya.ui.flag_project` view.""" | ||
|
||
def setUp(self): | ||
super(FlagProjecTests, self).setUp() | ||
super().setUp() | ||
|
||
create_project(self.session) | ||
self.user = models.User(email="[email protected]", username="user") | ||
|
Oops, something went wrong.