You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2022/11/09 21:38:19 UTC
[allura] branch db/pep8_nov2022 created (now e7f78cec4)
This is an automated email from the ASF dual-hosted git repository.
brondsem pushed a change to branch db/pep8_nov2022
in repository https://gitbox.apache.org/repos/asf/allura.git
at e7f78cec4 ignore a pure reformatting change
This branch includes the following new commits:
new 7114ce63e convert == and != True/False/None in assert stmts to is / is not
new a82d43f2e convert "assert not foo in bar" to "assert foo not in bar"
new be3e33e28 change [pep8] to [pycodestyle]
new c51a00794 allow and do not change the order of these imports
new b5a3bcba5 autopep8 -i --max-line-length 9999 on many files
new e7f78cec4 ignore a pure reformatting change
The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[allura] 01/06: convert == and != True/False/None in assert stmts to is / is not
Posted by br...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
brondsem pushed a commit to branch db/pep8_nov2022
in repository https://gitbox.apache.org/repos/asf/allura.git
commit 7114ce63e3d0a8ec8e23f52ec5362e4deef2e5c6
Author: Dave Brondsema <db...@slashdotmedia.com>
AuthorDate: Wed Nov 9 16:10:42 2022 -0500
convert == and != True/False/None in assert stmts to is / is not
---
Allura/allura/tests/functional/test_admin.py | 16 +++---
Allura/allura/tests/functional/test_auth.py | 24 ++++-----
.../allura/tests/functional/test_neighborhood.py | 8 +--
Allura/allura/tests/functional/test_rest.py | 18 +++----
Allura/allura/tests/functional/test_site_admin.py | 60 +++++++++++-----------
.../allura/tests/functional/test_user_profile.py | 8 +--
Allura/allura/tests/model/test_project.py | 2 +-
Allura/allura/tests/model/test_repo.py | 22 ++++----
Allura/allura/tests/test_app.py | 2 +-
Allura/allura/tests/test_helpers.py | 14 ++---
Allura/allura/tests/test_multifactor.py | 6 +--
Allura/allura/tests/test_plugin.py | 16 +++---
Allura/allura/tests/test_tasks.py | 4 +-
Allura/allura/tests/test_utils.py | 2 +-
Allura/allura/tests/test_webhooks.py | 22 ++++----
.../test_discussion_moderation_controller.py | 2 +-
Allura/allura/tests/unit/spam/test_spam_filter.py | 2 +-
.../allura/tests/unit/test_ldap_auth_provider.py | 4 +-
Allura/allura/tests/unit/test_repo.py | 20 ++++----
Allura/allura/tests/unit/test_solr.py | 2 +-
.../forgeactivity/tests/functional/test_rest.py | 8 +--
ForgeBlog/forgeblog/tests/functional/test_rest.py | 8 +--
.../forgediscussion/tests/functional/test_rest.py | 10 ++--
.../forgefiles/tests/functional/test_root.py | 2 +-
.../forgegit/tests/functional/test_controllers.py | 30 +++++------
ForgeGit/forgegit/tests/model/test_repository.py | 14 ++---
.../forgeimporters/github/tests/test_wiki.py | 4 +-
.../tests/github/functional/test_github.py | 2 +-
ForgeLink/forgelink/tests/functional/test_rest.py | 10 ++--
ForgeLink/forgelink/tests/functional/test_root.py | 2 +-
.../forgesvn/tests/functional/test_controllers.py | 6 +--
ForgeSVN/forgesvn/tests/model/test_repository.py | 4 +-
.../forgetracker/tests/functional/test_rest.py | 12 ++---
.../forgetracker/tests/functional/test_root.py | 36 ++++++-------
ForgeTracker/forgetracker/tests/test_app.py | 2 +-
.../forgetracker/tests/unit/test_globals_model.py | 2 +-
.../forgetracker/tests/unit/test_ticket_model.py | 4 +-
ForgeWiki/forgewiki/tests/functional/test_rest.py | 12 ++---
ForgeWiki/forgewiki/tests/functional/test_root.py | 6 +--
39 files changed, 214 insertions(+), 214 deletions(-)
diff --git a/Allura/allura/tests/functional/test_admin.py b/Allura/allura/tests/functional/test_admin.py
index 11ac71129..c0a879c3f 100644
--- a/Allura/allura/tests/functional/test_admin.py
+++ b/Allura/allura/tests/functional/test_admin.py
@@ -1161,7 +1161,7 @@ class TestRestInstallTool(TestRestApiBase):
'tool': 'tickets'
}
r = self.api_post('/rest/p/test/admin/install_tool/', **data)
- assert r.json['success'] == False
+ assert r.json['success'] is False
assert r.json['info'] == 'All arguments required.'
def test_invalid_tool(self):
@@ -1175,7 +1175,7 @@ class TestRestInstallTool(TestRestApiBase):
'mount_label': 'tickets_label1'
}
r = self.api_post('/rest/p/test/admin/install_tool/', **data)
- assert r.json['success'] == False
+ assert r.json['success'] is False
assert (r.json['info'] ==
'Incorrect tool name, or limit is reached.')
@@ -1190,7 +1190,7 @@ class TestRestInstallTool(TestRestApiBase):
'mount_label': 'tickets_label1'
}
r = self.api_post('/rest/p/test/admin/install_tool/', **data)
- assert r.json['success'] == False
+ assert r.json['success'] is False
assert (r.json['info'] ==
'Mount point "tickets_mount1" is invalid')
@@ -1205,7 +1205,7 @@ class TestRestInstallTool(TestRestApiBase):
'mount_label': 'tickets_label1'
}
r = self.api_post('/rest/p/test/admin/install_tool/', **data)
- assert r.json['success'] == True
+ assert r.json['success'] is True
assert (r.json['info'] ==
'Tool %s with mount_point %s and mount_label %s was created.'
% ('tickets', 'ticketsmount1', 'tickets_label1'))
@@ -1233,7 +1233,7 @@ class TestRestInstallTool(TestRestApiBase):
with h.push_config(c, user=M.User.query.get()):
project.install_app('wiki', mount_point=data['mount_point'])
r = self.api_post('/rest/p/test/admin/install_tool/', **data)
- assert r.json['success'] == False
+ assert r.json['success'] is False
assert r.json['info'] == 'Mount point already exists.'
def test_tool_installation_limit(self):
@@ -1249,12 +1249,12 @@ class TestRestInstallTool(TestRestApiBase):
'mount_label': 'wiki_label'
}
r = self.api_post('/rest/p/test/admin/install_tool/', **data)
- assert r.json['success'] == True
+ assert r.json['success'] is True
data['mount_point'] = 'wikimount1'
data['mount_label'] = 'wiki_label1'
r = self.api_post('/rest/p/test/admin/install_tool/', **data)
- assert r.json['success'] == False
+ assert r.json['success'] is False
assert (r.json['info'] ==
'Incorrect tool name, or limit is reached.')
@@ -1314,7 +1314,7 @@ class TestRestInstallTool(TestRestApiBase):
]
for datum in data:
r = self.api_post('/rest/p/test/admin/install_tool/', **datum)
- assert r.json['success'] == True
+ assert r.json['success'] is True
assert (r.json['info'] ==
'Tool %s with mount_point %s and mount_label %s was created.'
% (datum['tool'], datum['mount_point'], datum['mount_label']))
diff --git a/Allura/allura/tests/functional/test_auth.py b/Allura/allura/tests/functional/test_auth.py
index c1030a3cb..5c459db65 100644
--- a/Allura/allura/tests/functional/test_auth.py
+++ b/Allura/allura/tests/functional/test_auth.py
@@ -244,9 +244,9 @@ class TestAuth(TestController):
def test_track_login(self):
user = M.User.by_username('test-user')
- assert user.last_access['login_date'] == None
- assert user.last_access['login_ip'] == None
- assert user.last_access['login_ua'] == None
+ assert user.last_access['login_date'] is None
+ assert user.last_access['login_ip'] is None
+ assert user.last_access['login_ua'] is None
self.app.get('/').follow() # establish session
self.app.post('/auth/do_login',
@@ -260,7 +260,7 @@ class TestAuth(TestController):
antispam=True,
)
user = M.User.by_username('test-user')
- assert user.last_access['login_date'] != None
+ assert user.last_access['login_date'] is not None
assert user.last_access['login_ip'] == '127.0.0.1'
assert user.last_access['login_ua'] == 'browser'
@@ -275,7 +275,7 @@ class TestAuth(TestController):
_session_id=self.app.cookies['_session_id'],
), antispam=True)
assert r.session['username'] == username
- assert r.session['login_expires'] == True
+ assert r.session['login_expires'] is True
for header, contents in r.headerlist:
if header == 'Set-cookie':
@@ -287,7 +287,7 @@ class TestAuth(TestController):
_session_id=self.app.cookies['_session_id'],
), antispam=True)
assert r.session['username'] == username
- assert r.session['login_expires'] != True
+ assert r.session['login_expires'] is not True
for header, contents in r.headerlist:
if header == 'Set-cookie':
@@ -724,7 +724,7 @@ class TestAuth(TestController):
assert 'test-admin@users.localhost' not in r
# preferred address has not changed if email is not verified
user = M.User.query.get(username='test-admin')
- assert user.get_pref('email_address') == None
+ assert user.get_pref('email_address') is None
with td.audits('Display Name changed Test Admin => Admin', user=True):
r = self.app.post('/auth/preferences/update',
@@ -2168,7 +2168,7 @@ class TestDisableAccount(TestController):
'_session_id': self.app.cookies['_session_id'], })
assert 'Invalid password' in r
user = M.User.by_username('test-admin')
- assert user.disabled == False
+ assert user.disabled is False
def test_disable(self):
self.app.get('/').follow() # establish session
@@ -2180,7 +2180,7 @@ class TestDisableAccount(TestController):
assert flash['status'] == 'ok'
assert flash['message'] == 'Your account was successfully disabled!'
user = M.User.by_username('test-admin')
- assert user.disabled == True
+ assert user.disabled is True
class TestPasswordExpire(TestController):
@@ -2584,7 +2584,7 @@ class TestTwoFactor(TestController):
# confirm first, no change
assert 'Password Confirmation' in r
user = M.User.query.get(username='test-admin')
- assert user.get_pref('multifactor') == True
+ assert user.get_pref('multifactor') is True
# confirm submit, everything goes off
r.form['password'] = 'foo'
@@ -2592,8 +2592,8 @@ class TestTwoFactor(TestController):
r = r.form.submit()
assert 'Multifactor authentication has now been disabled.' == json.loads(self.webflash(r))['message'], self.webflash(r)
user = M.User.query.get(username='test-admin')
- assert user.get_pref('multifactor') == False
- assert TotpService().get().get_secret_key(user) == None
+ assert user.get_pref('multifactor') is False
+ assert TotpService().get().get_secret_key(user) is None
assert RecoveryCodeService().get().get_codes(user) == []
# email confirmation
diff --git a/Allura/allura/tests/functional/test_neighborhood.py b/Allura/allura/tests/functional/test_neighborhood.py
index 636830de4..90ab50c10 100644
--- a/Allura/allura/tests/functional/test_neighborhood.py
+++ b/Allura/allura/tests/functional/test_neighborhood.py
@@ -993,8 +993,8 @@ class TestPhoneVerificationOnProjectRegistration(TestController):
assert r.json == expected
rid = r.session.get('phone_verification.request_id')
hash = r.session.get('phone_verification.number_hash')
- assert rid == None
- assert hash == None
+ assert rid is None
+ assert hash is None
@patch.object(g, 'phone_service', autospec=True)
def test_verify_phone(self, phone_service):
@@ -1057,7 +1057,7 @@ class TestPhoneVerificationOnProjectRegistration(TestController):
user = M.User.by_username('test-admin')
hash = user.get_tool_data('phone_verification', 'number_hash')
- assert hash == None
+ assert hash is None
@patch.object(g, 'phone_service', autospec=True)
def test_check_phone_verification_ok(self, phone_service):
@@ -1104,7 +1104,7 @@ class TestPhoneVerificationOnProjectRegistration(TestController):
extra_environ=dict(username='test-user'),
antispam=True)
overlay = r.html.find('div', {'id': 'phone_verification_overlay'})
- assert overlay != None
+ assert overlay is not None
header = overlay.find('h2')
iframe = overlay.find('iframe')
assert header.getText() == 'Phone Verification Required'
diff --git a/Allura/allura/tests/functional/test_rest.py b/Allura/allura/tests/functional/test_rest.py
index 265cfcd12..5ee8a45ff 100644
--- a/Allura/allura/tests/functional/test_rest.py
+++ b/Allura/allura/tests/functional/test_rest.py
@@ -225,12 +225,12 @@ class TestRestHome(TestRestApiBase):
'/rest/p/has_access?user=babadook&perm=read',
user='root')
assert r.status_int == 200
- assert r.json['result'] == False
+ assert r.json['result'] is False
r = self.api_get(
'/rest/p/has_access?user=test-admin&perm=jump',
user='root')
assert r.status_int == 200
- assert r.json['result'] == False
+ assert r.json['result'] is False
def test_neighborhood_has_access_not_admin(self):
"""
@@ -247,12 +247,12 @@ class TestRestHome(TestRestApiBase):
'/rest/p/has_access?user=root&perm=update',
user='root')
assert r.status_int == 200
- assert r.json['result'] == True
+ assert r.json['result'] is True
r = self.api_get(
'/rest/p/has_access?user=test-user&perm=update',
user='root')
assert r.status_int == 200
- assert r.json['result'] == False
+ assert r.json['result'] is False
def test_neighborhood(self):
self.api_get('/rest/p/', status=404)
@@ -279,12 +279,12 @@ class TestRestHome(TestRestApiBase):
'/rest/p/test/has_access?user=babadook&perm=read',
user='root')
assert r.status_int == 200
- assert r.json['result'] == False
+ assert r.json['result'] is False
r = self.api_get(
'/rest/p/test/has_access?user=test-admin&perm=jump',
user='root')
assert r.status_int == 200
- assert r.json['result'] == False
+ assert r.json['result'] is False
def test_project_has_access_not_admin(self):
"""
@@ -301,19 +301,19 @@ class TestRestHome(TestRestApiBase):
'/rest/p/test/has_access?user=test-admin&perm=update',
user='root')
assert r.status_int == 200
- assert r.json['result'] == True
+ assert r.json['result'] is True
r = self.api_get(
'/rest/p/test/has_access?user=test-user&perm=update',
user='root')
assert r.status_int == 200
- assert r.json['result'] == False
+ assert r.json['result'] is False
def test_subproject_has_access(self):
r = self.api_get(
'/rest/p/test/sub1/has_access?user=test-admin&perm=update',
user='root')
assert r.status_int == 200
- assert r.json['result'] == True
+ assert r.json['result'] is True
def test_unicode(self):
self.app.post(
diff --git a/Allura/allura/tests/functional/test_site_admin.py b/Allura/allura/tests/functional/test_site_admin.py
index f4cb04855..cc5797890 100644
--- a/Allura/allura/tests/functional/test_site_admin.py
+++ b/Allura/allura/tests/functional/test_site_admin.py
@@ -514,8 +514,8 @@ class TestUserDetails(TestController):
def test_disable_user(self):
# user was not pending
- assert M.User.by_username('test-user-3').disabled == False
- assert M.User.by_username('test-user-3').pending == False
+ assert M.User.by_username('test-user-3').disabled is False
+ assert M.User.by_username('test-user-3').pending is False
r = self.app.get('/nf/admin/user/test-user-3')
form = r.forms[0]
assert form['username'].value == 'test-user-3'
@@ -525,16 +525,16 @@ class TestUserDetails(TestController):
r = form.submit()
assert M.AuditLog.query.find().count() == 1
assert 'User disabled' in self.webflash(r)
- assert M.User.by_username('test-user-3').disabled == True
- assert M.User.by_username('test-user-3').pending == False
+ assert M.User.by_username('test-user-3').disabled is True
+ assert M.User.by_username('test-user-3').pending is False
# user was pending
user = M.User.by_username('test-user-3')
user.disabled = False
user.pending = True
ThreadLocalORMSession.flush_all()
- assert M.User.by_username('test-user-3').disabled == False
- assert M.User.by_username('test-user-3').pending == True
+ assert M.User.by_username('test-user-3').disabled is False
+ assert M.User.by_username('test-user-3').pending is True
r = self.app.get('/nf/admin/user/test-user-3')
form = r.forms[0]
assert form['username'].value == 'test-user-3'
@@ -544,16 +544,16 @@ class TestUserDetails(TestController):
r = form.submit()
assert M.AuditLog.query.find().count() == 1
assert 'User disabled' in self.webflash(r)
- assert M.User.by_username('test-user-3').disabled == True
- assert M.User.by_username('test-user-3').pending == True
+ assert M.User.by_username('test-user-3').disabled is True
+ assert M.User.by_username('test-user-3').pending is True
def test_enable_user(self):
# user was not pending
user = M.User.by_username('test-user-3')
user.disabled = True
ThreadLocalORMSession.flush_all()
- assert M.User.by_username('test-user-3').disabled == True
- assert M.User.by_username('test-user-3').pending == False
+ assert M.User.by_username('test-user-3').disabled is True
+ assert M.User.by_username('test-user-3').pending is False
r = self.app.get('/nf/admin/user/test-user-3')
form = r.forms[0]
assert form['username'].value == 'test-user-3'
@@ -563,16 +563,16 @@ class TestUserDetails(TestController):
r = form.submit()
assert M.AuditLog.query.find().count() == 1
assert 'User enabled' in self.webflash(r)
- assert M.User.by_username('test-user-3').disabled == False
- assert M.User.by_username('test-user-3').pending == False
+ assert M.User.by_username('test-user-3').disabled is False
+ assert M.User.by_username('test-user-3').pending is False
# user was pending
user = M.User.by_username('test-user-3')
user.disabled = False
user.pending = True
ThreadLocalORMSession.flush_all()
- assert M.User.by_username('test-user-3').disabled == False
- assert M.User.by_username('test-user-3').pending == True
+ assert M.User.by_username('test-user-3').disabled is False
+ assert M.User.by_username('test-user-3').pending is True
r = self.app.get('/nf/admin/user/test-user-3')
form = r.forms[0]
assert form['username'].value == 'test-user-3'
@@ -582,16 +582,16 @@ class TestUserDetails(TestController):
r = form.submit()
assert M.AuditLog.query.find().count() == 1
assert 'User enabled' in self.webflash(r)
- assert M.User.by_username('test-user-3').disabled == False
- assert M.User.by_username('test-user-3').pending == False
+ assert M.User.by_username('test-user-3').disabled is False
+ assert M.User.by_username('test-user-3').pending is False
# user was pending and disabled
user = M.User.by_username('test-user-3')
user.disabled = True
user.pending = True
ThreadLocalORMSession.flush_all()
- assert M.User.by_username('test-user-3').disabled == True
- assert M.User.by_username('test-user-3').pending == True
+ assert M.User.by_username('test-user-3').disabled is True
+ assert M.User.by_username('test-user-3').pending is True
r = self.app.get('/nf/admin/user/test-user-3')
form = r.forms[0]
assert form['username'].value == 'test-user-3'
@@ -601,16 +601,16 @@ class TestUserDetails(TestController):
r = form.submit()
assert M.AuditLog.query.find().count() == 1
assert 'User enabled' in self.webflash(r)
- assert M.User.by_username('test-user-3').disabled == False
- assert M.User.by_username('test-user-3').pending == False
+ assert M.User.by_username('test-user-3').disabled is False
+ assert M.User.by_username('test-user-3').pending is False
def test_set_pending(self):
# user was disabled
user = M.User.by_username('test-user-3')
user.disabled = True
ThreadLocalORMSession.flush_all()
- assert M.User.by_username('test-user-3').disabled == True
- assert M.User.by_username('test-user-3').pending == False
+ assert M.User.by_username('test-user-3').disabled is True
+ assert M.User.by_username('test-user-3').pending is False
r = self.app.get('/nf/admin/user/test-user-3')
form = r.forms[0]
assert form['username'].value == 'test-user-3'
@@ -620,16 +620,16 @@ class TestUserDetails(TestController):
r = form.submit()
assert M.AuditLog.query.find().count() == 1
assert 'Set user status to pending' in self.webflash(r)
- assert M.User.by_username('test-user-3').disabled == False
- assert M.User.by_username('test-user-3').pending == True
+ assert M.User.by_username('test-user-3').disabled is False
+ assert M.User.by_username('test-user-3').pending is True
# user was enabled
user = M.User.by_username('test-user-3')
user.pending = False
user.disabled = False
ThreadLocalORMSession.flush_all()
- assert M.User.by_username('test-user-3').disabled == False
- assert M.User.by_username('test-user-3').pending == False
+ assert M.User.by_username('test-user-3').disabled is False
+ assert M.User.by_username('test-user-3').pending is False
r = self.app.get('/nf/admin/user/test-user-3')
form = r.forms[0]
assert form['username'].value == 'test-user-3'
@@ -639,8 +639,8 @@ class TestUserDetails(TestController):
r = form.submit()
assert M.AuditLog.query.find().count() == 1
assert 'Set user status to pending' in self.webflash(r)
- assert M.User.by_username('test-user-3').disabled == False
- assert M.User.by_username('test-user-3').pending == True
+ assert M.User.by_username('test-user-3').disabled is False
+ assert M.User.by_username('test-user-3').pending is True
def test_emails(self):
# add test@example.com
@@ -654,7 +654,7 @@ class TestUserDetails(TestController):
r = self.app.get('/nf/admin/user/test-user')
assert 'test@example.com' in r
em = M.EmailAddress.get(email='test@example.com')
- assert em.confirmed == True
+ assert em.confirmed is True
user = M.User.query.get(username='test-user')
assert user.get_pref('email_address') == 'test@example.com'
@@ -669,7 +669,7 @@ class TestUserDetails(TestController):
r = self.app.get('/nf/admin/user/test-user')
assert 'test2@example.com' in r
em = M.EmailAddress.get(email='test2@example.com')
- assert em.confirmed == True
+ assert em.confirmed is True
user = M.User.query.get(username='test-user')
assert user.get_pref('email_address') == 'test@example.com'
diff --git a/Allura/allura/tests/functional/test_user_profile.py b/Allura/allura/tests/functional/test_user_profile.py
index 0b93bdd42..bfa920a81 100644
--- a/Allura/allura/tests/functional/test_user_profile.py
+++ b/Allura/allura/tests/functional/test_user_profile.py
@@ -291,12 +291,12 @@ class TestUserProfileHasAccessAPI(TestRestApiBase):
'/rest/u/test-admin/profile/has_access?user=babadook&perm=read',
user='root')
assert r.status_int == 200
- assert r.json['result'] == False
+ assert r.json['result'] is False
r = self.api_get(
'/rest/u/test-admin/profile/has_access?user=test-user&perm=jump',
user='root')
assert r.status_int == 200
- assert r.json['result'] == False
+ assert r.json['result'] is False
@td.with_user_project('test-admin')
def test_has_access_not_admin(self):
@@ -315,9 +315,9 @@ class TestUserProfileHasAccessAPI(TestRestApiBase):
'/rest/u/test-admin/profile/has_access?user=test-admin&perm=admin',
user='root')
assert r.status_int == 200
- assert r.json['result'] == True
+ assert r.json['result'] is True
r = self.api_get(
'/rest/u/test-admin/profile/has_access?user=test-user&perm=admin',
user='root')
assert r.status_int == 200
- assert r.json['result'] == False
+ assert r.json['result'] is False
diff --git a/Allura/allura/tests/model/test_project.py b/Allura/allura/tests/model/test_project.py
index c4daf9474..48297a6e8 100644
--- a/Allura/allura/tests/model/test_project.py
+++ b/Allura/allura/tests/model/test_project.py
@@ -101,7 +101,7 @@ class TestProjectModel:
for v in [None, '', 'bad@email']:
with td.raises(ToolError):
c.project.install_app('Tickets', 'test-tickets', **{name: v})
- assert c.project.app_instance('test-tickets') == None
+ assert c.project.app_instance('test-tickets') is None
c.project.install_app('Tickets', 'test-tickets', **{name: 'e@e.com'})
app = c.project.app_instance('test-tickets')
assert app.config.options[name] == 'e@e.com'
diff --git a/Allura/allura/tests/model/test_repo.py b/Allura/allura/tests/model/test_repo.py
index 9b89a6805..85fa9b9fb 100644
--- a/Allura/allura/tests/model/test_repo.py
+++ b/Allura/allura/tests/model/test_repo.py
@@ -707,13 +707,13 @@ class TestMergeRequest:
def test_get_can_merge_cache(self):
key = self.mr.can_merge_cache_key()
- assert self.mr.get_can_merge_cache() == None
+ assert self.mr.get_can_merge_cache() is None
self.mr.can_merge_cache[key] = True
- assert self.mr.get_can_merge_cache() == True
+ assert self.mr.get_can_merge_cache() is True
self.mr.can_merge_cache_key = lambda: '123-123'
self.mr.can_merge_cache['123-123'] = False
- assert self.mr.get_can_merge_cache() == False
+ assert self.mr.get_can_merge_cache() is False
def test_set_can_merge_cache(self):
key = self.mr.can_merge_cache_key()
@@ -727,7 +727,7 @@ class TestMergeRequest:
def test_can_merge_merged(self):
self.mr.status = 'merged'
- assert self.mr.can_merge() == True
+ assert self.mr.can_merge() is True
@mock.patch('allura.tasks.repo_tasks.can_merge', autospec=True)
def test_can_merge_cached(self, can_merge_task):
@@ -737,22 +737,22 @@ class TestMergeRequest:
self.mr.set_can_merge_cache(False)
self.mr = self._reload_mr_from_db(self.mr)
- assert self.mr.can_merge() == False
+ assert self.mr.can_merge() is False
self.mr.set_can_merge_cache(True)
self.mr = self._reload_mr_from_db(self.mr)
- assert self.mr.can_merge() == True
+ assert self.mr.can_merge() is True
assert can_merge_task.post.call_count == 0
@mock.patch('allura.tasks.repo_tasks.can_merge', autospec=True)
def test_can_merge_not_cached(self, can_merge_task):
- assert self.mr.can_merge() == None
+ assert self.mr.can_merge() is None
can_merge_task.post.assert_called_once_with(self.mr._id)
@mock.patch('allura.tasks.repo_tasks.can_merge', autospec=True)
def test_can_merge_disabled(self, can_merge_task):
self.mr.merge_allowed.return_value = False
- assert self.mr.can_merge() == None
+ assert self.mr.can_merge() is None
assert can_merge_task.post.call_count == 0
@mock.patch('allura.tasks.repo_tasks.merge', autospec=True)
@@ -764,11 +764,11 @@ class TestMergeRequest:
merge_task.reset_mock()
self.mr.merge_task_status = lambda: 'ready'
self.mr.merge()
- assert merge_task.post.called == False
+ assert merge_task.post.called is False
def test_merge_task_status(self):
from allura.tasks import repo_tasks
- assert self.mr.merge_task_status() == None
+ assert self.mr.merge_task_status() is None
repo_tasks.merge.post(self.mr._id)
assert self.mr.merge_task_status() == 'ready'
M.MonQTask.run_ready()
@@ -776,7 +776,7 @@ class TestMergeRequest:
def test_can_merge_task_status(self):
from allura.tasks import repo_tasks
- assert self.mr.can_merge_task_status() == None
+ assert self.mr.can_merge_task_status() is None
repo_tasks.can_merge.post(self.mr._id)
assert self.mr.can_merge_task_status() == 'ready'
with mock.patch('allura.model.repository.MergeRequest.set_can_merge_cache'):
diff --git a/Allura/allura/tests/test_app.py b/Allura/allura/tests/test_app.py
index 997dd13f8..a23274168 100644
--- a/Allura/allura/tests/test_app.py
+++ b/Allura/allura/tests/test_app.py
@@ -63,7 +63,7 @@ class TestApp:
def test_config_option_without_validator(self):
opt = app.ConfigOption('test1', str, None)
- assert opt.validate(None) == None
+ assert opt.validate(None) is None
assert opt.validate('') == ''
assert opt.validate('val') == 'val'
diff --git a/Allura/allura/tests/test_helpers.py b/Allura/allura/tests/test_helpers.py
index 21926356c..9e2ef3f88 100644
--- a/Allura/allura/tests/test_helpers.py
+++ b/Allura/allura/tests/test_helpers.py
@@ -310,18 +310,18 @@ def test_get_tool_packages():
def test_get_first():
- assert h.get_first({}, 'title') == None
- assert h.get_first({'title': None}, 'title') == None
+ assert h.get_first({}, 'title') is None
+ assert h.get_first({'title': None}, 'title') is None
assert h.get_first({'title': 'Value'}, 'title') == 'Value'
assert h.get_first({'title': ['Value']}, 'title') == 'Value'
- assert h.get_first({'title': []}, 'title') == None
+ assert h.get_first({'title': []}, 'title') is None
assert h.get_first({'title': ['Value']}, 'title') == 'Value'
@patch('allura.lib.search.c')
def test_inject_user(context):
user = Mock(username='user01')
- assert inject_user(None, user) == None
+ assert inject_user(None, user) is None
assert inject_user('', user) == ''
assert inject_user('query', user) == 'query'
result = inject_user('reported_by_s:$USER OR assigned_to_s:$USER', user)
@@ -357,8 +357,8 @@ def test_split_select_field_options():
def test_notifications_disabled():
project = Mock(notifications_disabled=False)
with h.notifications_disabled(project):
- assert project.notifications_disabled == True
- assert project.notifications_disabled == False
+ assert project.notifications_disabled is True
+ assert project.notifications_disabled is False
@skipIf(module_not_available('html2text'), 'html2text required')
@@ -664,7 +664,7 @@ class TestRateLimit(TestCase):
def test_hide_private_info():
- assert h.hide_private_info(None) == None
+ assert h.hide_private_info(None) is None
assert h.hide_private_info('') == ''
assert h.hide_private_info('foo bar baz@bing.com') == 'foo bar baz@...'
assert h.hide_private_info('some <1...@2.com>\nor asdf+asdf.f@g.f.x') == 'some <1...@...>\nor asdf+asdf.f@...'
diff --git a/Allura/allura/tests/test_multifactor.py b/Allura/allura/tests/test_multifactor.py
index 42b8c6ce9..8ba2454bc 100644
--- a/Allura/allura/tests/test_multifactor.py
+++ b/Allura/allura/tests/test_multifactor.py
@@ -56,8 +56,8 @@ class TestGoogleAuthenticatorFile:
gaf = GoogleAuthenticatorFile.load(self.sample)
assert gaf.key == b'\xf8\x97\xbb/\xfd\xf2%\x01S\xa7\x8dZ\x07\x0c\\\xe4'
assert gaf.options['RATE_LIMIT'] == '3 30'
- assert gaf.options['DISALLOW_REUSE'] == None
- assert gaf.options['TOTP_AUTH'] == None
+ assert gaf.options['DISALLOW_REUSE'] is None
+ assert gaf.options['TOTP_AUTH'] is None
assert gaf.recovery_codes == [
'43504045',
'16951331',
@@ -274,7 +274,7 @@ class TestAnyRecoveryCodeServiceImplementation:
]
recovery.replace_codes(user, codes)
result = recovery.verify_and_remove_code(user, '12345')
- assert result == True
+ assert result is True
assert recovery.get_codes(user) == ['67890']
def test_rate_limiting(self):
diff --git a/Allura/allura/tests/test_plugin.py b/Allura/allura/tests/test_plugin.py
index c6c78fc77..f1dfaf53e 100644
--- a/Allura/allura/tests/test_plugin.py
+++ b/Allura/allura/tests/test_plugin.py
@@ -286,7 +286,7 @@ class TestThemeProvider:
@patch('allura.lib.plugin.g')
def test_app_icon_str_invalid(self, g):
g.entry_points = {'tool': {'testapp': Mock()}}
- assert ThemeProvider().app_icon_url('invalid', 24) == None
+ assert ThemeProvider().app_icon_url('invalid', 24) is None
@patch('allura.app.g')
def test_app_icon_app(self, g):
@@ -676,7 +676,7 @@ class TestLocalAuthenticationProvider:
with audits('Account enabled', user=True, actor='test-admin'):
self.provider.enable_user(user)
ThreadLocalORMSession.flush_all()
- assert user.disabled == False
+ assert user.disabled is False
def test_disable_user(self):
user = Mock(disabled=False, __ming__=Mock(), is_anonymous=lambda: False, _id=ObjectId())
@@ -684,7 +684,7 @@ class TestLocalAuthenticationProvider:
with audits('Account disabled', user=True, actor='test-admin'):
self.provider.disable_user(user)
ThreadLocalORMSession.flush_all()
- assert user.disabled == True
+ assert user.disabled is True
def test_login_details_from_auditlog(self):
user = M.User(username='asfdasdf')
@@ -695,11 +695,11 @@ class TestLocalAuthenticationProvider:
detail = self.provider.login_details_from_auditlog(M.AuditLog(message='IP Address: 1.2.3.4\nFoo', user=user))
assert detail.user_id == user._id
assert detail.ip == '1.2.3.4'
- assert detail.ua == None
+ assert detail.ua is None
detail = self.provider.login_details_from_auditlog(M.AuditLog(message='Foo\nIP Address: 1.2.3.4\nFoo', user=user))
assert detail.ip == '1.2.3.4'
- assert detail.ua == None
+ assert detail.ua is None
assert (self.provider.login_details_from_auditlog(M.AuditLog(
message='blah blah IP Address: 1.2.3.4\nFoo', user=user)) ==
@@ -707,7 +707,7 @@ class TestLocalAuthenticationProvider:
detail = self.provider.login_details_from_auditlog(M.AuditLog(
message='User-Agent: Mozilla/Firefox\nFoo', user=user))
- assert detail.ip == None
+ assert detail.ip is None
assert detail.ua == 'Mozilla/Firefox'
detail = self.provider.login_details_from_auditlog(M.AuditLog(
@@ -719,8 +719,8 @@ class TestLocalAuthenticationProvider:
user = M.User(username='foobarbaz')
detail = self.provider.get_login_detail(Request.blank('/'), user)
assert detail.user_id == user._id
- assert detail.ip == None
- assert detail.ua == None
+ assert detail.ip is None
+ assert detail.ua is None
detail = self.provider.get_login_detail(Request.blank('/',
headers={'User-Agent': 'mybrowser'},
diff --git a/Allura/allura/tests/test_tasks.py b/Allura/allura/tests/test_tasks.py
index 3acd939b9..bb61cb95a 100644
--- a/Allura/allura/tests/test_tasks.py
+++ b/Allura/allura/tests/test_tasks.py
@@ -66,7 +66,7 @@ class TestRepoTasks(unittest.TestCase):
repo_tasks.clone(None, None, fake_source_url)
assert post_event.call_args[0][0] == 'repo_clone_task_failed'
assert post_event.call_args[0][1] == fake_source_url
- assert post_event.call_args[0][2] == None
+ assert post_event.call_args[0][2] is None
# ignore args[3] which is a traceback string
@mock.patch('allura.tasks.repo_tasks.session', autospec=True)
@@ -653,7 +653,7 @@ class TestExportTasks(unittest.TestCase):
assert 'Sample instructions for test' in text
def test_bulk_export_status(self):
- assert c.project.bulk_export_status() == None
+ assert c.project.bulk_export_status() is None
export_tasks.bulk_export.post(['wiki'])
assert c.project.bulk_export_status() == 'busy'
diff --git a/Allura/allura/tests/test_utils.py b/Allura/allura/tests/test_utils.py
index d9f5229a9..5165082a3 100644
--- a/Allura/allura/tests/test_utils.py
+++ b/Allura/allura/tests/test_utils.py
@@ -339,7 +339,7 @@ def test_empty_cursor():
"""EmptyCursors conforms to specification of Ming's ODMCursor"""
cursor = utils.EmptyCursor()
assert cursor.count() == 0
- assert cursor.first() == None
+ assert cursor.first() is None
assert cursor.all() == []
assert cursor.limit(10) == cursor
assert cursor.skip(10) == cursor
diff --git a/Allura/allura/tests/test_webhooks.py b/Allura/allura/tests/test_webhooks.py
index d0785343a..90523beb8 100644
--- a/Allura/allura/tests/test_webhooks.py
+++ b/Allura/allura/tests/test_webhooks.py
@@ -593,16 +593,16 @@ class TestRepoPushWebhookSender(TestWebhookBase):
sender = RepoPushWebhookSender()
# default
- assert sender.enforce_limit(self.git) == True
+ assert sender.enforce_limit(self.git) is True
add_webhooks('one', 3)
- assert sender.enforce_limit(self.git) == False
+ assert sender.enforce_limit(self.git) is False
# config
limit = json.dumps({'git': 5})
with h.push_config(config, **{'webhook.repo_push.max_hooks': limit}):
- assert sender.enforce_limit(self.git) == True
+ assert sender.enforce_limit(self.git) is True
add_webhooks('two', 3)
- assert sender.enforce_limit(self.git) == False
+ assert sender.enforce_limit(self.git) is False
def test_before(self):
sender = RepoPushWebhookSender()
@@ -630,24 +630,24 @@ class TestModels(TestWebhookBase):
def test_webhook_enforce_limit(self):
self.wh.last_sent = None
- assert self.wh.enforce_limit() == True
+ assert self.wh.enforce_limit() is True
# default value
self.wh.last_sent = dt.datetime.utcnow() - dt.timedelta(seconds=31)
- assert self.wh.enforce_limit() == True
+ assert self.wh.enforce_limit() is True
self.wh.last_sent = dt.datetime.utcnow() - dt.timedelta(seconds=15)
- assert self.wh.enforce_limit() == False
+ assert self.wh.enforce_limit() is False
# value from config
with h.push_config(config, **{'webhook.repo_push.limit': 100}):
self.wh.last_sent = dt.datetime.utcnow() - dt.timedelta(seconds=101)
- assert self.wh.enforce_limit() == True
+ assert self.wh.enforce_limit() is True
self.wh.last_sent = dt.datetime.utcnow() - dt.timedelta(seconds=35)
- assert self.wh.enforce_limit() == False
+ assert self.wh.enforce_limit() is False
@patch('allura.model.webhook.dt', autospec=True)
def test_update_limit(self, dt_mock):
_now = dt.datetime(2015, 2, 2, 13, 39)
dt_mock.datetime.utcnow.return_value = _now
- assert self.wh.last_sent == None
+ assert self.wh.last_sent is None
self.wh.update_limit()
session(self.wh).expunge(self.wh)
assert M.Webhook.query.get(_id=self.wh._id).last_sent == _now
@@ -884,7 +884,7 @@ class TestWebhookRestController(TestRestApiBase):
r = self.api_delete(url, status=200)
assert r.json == {'result': 'ok'}
assert M.Webhook.query.find().count() == 2
- assert M.Webhook.query.get(_id=webhook._id) == None
+ assert M.Webhook.query.get(_id=webhook._id) is None
def test_permissions(self):
self.api_get(self.url, user='test-user', status=403)
diff --git a/Allura/allura/tests/unit/controllers/test_discussion_moderation_controller.py b/Allura/allura/tests/unit/controllers/test_discussion_moderation_controller.py
index f689fa5f7..4f7f61d78 100644
--- a/Allura/allura/tests/unit/controllers/test_discussion_moderation_controller.py
+++ b/Allura/allura/tests/unit/controllers/test_discussion_moderation_controller.py
@@ -59,7 +59,7 @@ class TestWhenModerating(WithDatabase):
def test_that_it_can_be_deleted(self):
self.moderate_post(delete=True)
- assert self.get_post() == None
+ assert self.get_post() is None
def moderate_post(self, **kwargs):
with patch('allura.controllers.discuss.flash'):
diff --git a/Allura/allura/tests/unit/spam/test_spam_filter.py b/Allura/allura/tests/unit/spam/test_spam_filter.py
index ad32d690a..a00847ab9 100644
--- a/Allura/allura/tests/unit/spam/test_spam_filter.py
+++ b/Allura/allura/tests/unit/spam/test_spam_filter.py
@@ -88,7 +88,7 @@ class TestSpamFilterFunctional:
results = SpamCheckResult.query.find().all()
assert len(results) == 1
- assert results[0].result == True
+ assert results[0].result is True
assert results[0].user.username == 'test-user'
diff --git a/Allura/allura/tests/unit/test_ldap_auth_provider.py b/Allura/allura/tests/unit/test_ldap_auth_provider.py
index a480be211..1b0967dfc 100644
--- a/Allura/allura/tests/unit/test_ldap_auth_provider.py
+++ b/Allura/allura/tests/unit/test_ldap_auth_provider.py
@@ -115,11 +115,11 @@ class TestLdapAuthenticationProvider:
ldap.dn.escape_dn_chars = lambda x: x
self.provider._encode_password = Mock(return_value=b'new-password-hash')
- assert M.User.query.get(username=user_doc['username']) == None
+ assert M.User.query.get(username=user_doc['username']) is None
with h.push_config(config, **{'auth.ldap.autoregister': 'false'}):
self.provider.register_user(user_doc)
ThreadLocalORMSession.flush_all()
- assert M.User.query.get(username=user_doc['username']) != None
+ assert M.User.query.get(username=user_doc['username']) is not None
dn = 'uid=%s,ou=people,dc=localdomain' % user_doc['username']
ldap.initialize.assert_called_once_with('ldaps://localhost/')
diff --git a/Allura/allura/tests/unit/test_repo.py b/Allura/allura/tests/unit/test_repo.py
index 47945e24f..5f9756ea7 100644
--- a/Allura/allura/tests/unit/test_repo.py
+++ b/Allura/allura/tests/unit/test_repo.py
@@ -104,40 +104,40 @@ class TestBlob(unittest.TestCase):
def test_pypeline_view(self):
blob = M.repository.Blob(MagicMock(), 'INSTALL.mdown', 'blob1')
- assert blob.has_pypeline_view == True
+ assert blob.has_pypeline_view is True
def test_has_html_view_text_mime(self):
blob = M.repository.Blob(MagicMock(), 'INSTALL', 'blob1')
blob.content_type = 'text/plain'
- assert blob.has_html_view == True
+ assert blob.has_html_view is True
def test_has_html_view_text_ext(self):
blob = M.repository.Blob(MagicMock(), 'INSTALL.txt', 'blob1')
blob.content_type = 'foo/bar'
- assert blob.has_html_view == True
+ assert blob.has_html_view is True
def test_has_html_view_text_contents(self):
blob = M.repository.Blob(MagicMock(), 'INSTALL', 'blob1')
blob.content_type = 'foo/bar'
blob.text = b'hello world, this is text here'
- assert blob.has_html_view == True
+ assert blob.has_html_view is True
def test_has_html_view_bin_ext(self):
blob = M.repository.Blob(MagicMock(), 'INSTALL.zip', 'blob1')
- assert blob.has_html_view == False
+ assert blob.has_html_view is False
def test_has_html_view_bin_content(self):
blob = M.repository.Blob(MagicMock(), 'myfile', 'blob1')
blob.content_type = 'whatever'
blob.text = b'\0\0\0\0'
- assert blob.has_html_view == False
+ assert blob.has_html_view is False
def test_has_html_view__local_setting_override_bin(self):
blob = M.repository.Blob(MagicMock(), 'myfile.dat', 'blob1')
blob.content_type = 'whatever'
blob.text = b'\0\0\0\0'
blob.repo._additional_viewable_extensions = ['.dat']
- assert blob.has_html_view == True
+ assert blob.has_html_view is True
class TestCommit(unittest.TestCase):
@@ -167,13 +167,13 @@ class TestCommit(unittest.TestCase):
tree = commit.get_tree(create=False)
assert not commit.repo.compute_tree_new.called
assert not c.model_cache.get.called
- assert tree == None
+ assert tree is None
commit.tree_id = 'tree'
tree = commit.get_tree(create=False)
assert not commit.repo.compute_tree_new.called
c.model_cache.get.assert_called_with(M.repository.Tree, dict(_id='tree'))
- assert tree == None
+ assert tree is None
_tree = Mock()
c.model_cache.get.return_value = _tree
@@ -194,7 +194,7 @@ class TestCommit(unittest.TestCase):
commit.repo.compute_tree_new.assert_called_once_with(commit)
assert not c.model_cache.get.called
assert not tree_get.called
- assert tree == None
+ assert tree is None
commit.repo.compute_tree_new.reset_mock()
commit.repo.compute_tree_new.return_value = 'tree'
diff --git a/Allura/allura/tests/unit/test_solr.py b/Allura/allura/tests/unit/test_solr.py
index c24bfdb35..588830804 100644
--- a/Allura/allura/tests/unit/test_solr.py
+++ b/Allura/allura/tests/unit/test_solr.py
@@ -127,7 +127,7 @@ class TestSearchIndexable(unittest.TestCase):
def test_solarize_empty_index(self):
self.obj.index = lambda: None
- assert self.obj.solarize() == None
+ assert self.obj.solarize() is None
def test_solarize_doc_without_text(self):
self.obj.index = lambda: dict()
diff --git a/ForgeActivity/forgeactivity/tests/functional/test_rest.py b/ForgeActivity/forgeactivity/tests/functional/test_rest.py
index 39db63a9c..453fd2e7d 100644
--- a/ForgeActivity/forgeactivity/tests/functional/test_rest.py
+++ b/ForgeActivity/forgeactivity/tests/functional/test_rest.py
@@ -41,12 +41,12 @@ class TestActivityHasAccessAPI(TestRestApiBase):
'/rest/p/test/activity/has_access?user=babadook&perm=read',
user='root')
assert r.status_int == 200
- assert r.json['result'] == False
+ assert r.json['result'] is False
r = self.api_get(
'/rest/p/test/activity/has_access?user=test-user&perm=jump',
user='root')
assert r.status_int == 200
- assert r.json['result'] == False
+ assert r.json['result'] is False
def test_has_access_not_admin(self):
"""
@@ -63,12 +63,12 @@ class TestActivityHasAccessAPI(TestRestApiBase):
'/rest/p/test/activity/has_access?user=test-admin&perm=admin',
user='root')
assert r.status_int == 200
- assert r.json['result'] == True
+ assert r.json['result'] is True
r = self.api_get(
'/rest/p/test/activity/has_access?user=test-user&perm=admin',
user='root')
assert r.status_int == 200
- assert r.json['result'] == False
+ assert r.json['result'] is False
def test_user_api(self):
diff --git a/ForgeBlog/forgeblog/tests/functional/test_rest.py b/ForgeBlog/forgeblog/tests/functional/test_rest.py
index 59c06d5ad..76855cdc7 100644
--- a/ForgeBlog/forgeblog/tests/functional/test_rest.py
+++ b/ForgeBlog/forgeblog/tests/functional/test_rest.py
@@ -222,12 +222,12 @@ class TestBlogApi(TestRestApiBase):
'/rest/p/test/blog/has_access?user=babadook&perm=read',
user='root')
assert r.status_int == 200
- assert r.json['result'] == False
+ assert r.json['result'] is False
r = self.api_get(
'/rest/p/test/blog/has_access?user=test-user&perm=jump',
user='root')
assert r.status_int == 200
- assert r.json['result'] == False
+ assert r.json['result'] is False
def test_has_access_not_admin(self):
"""
@@ -244,12 +244,12 @@ class TestBlogApi(TestRestApiBase):
'/rest/p/test/blog/has_access?user=test-admin&perm=post&access_token=ABCDEF',
user='root')
assert r.status_int == 200
- assert r.json['result'] == True
+ assert r.json['result'] is True
r = self.api_get(
'/rest/p/test/blog/has_access?user=*anonymous&perm=admin',
user='root')
assert r.status_int == 200
- assert r.json['result'] == False
+ assert r.json['result'] is False
def test_create_post_limit_by_project(self):
data = {
diff --git a/ForgeDiscussion/forgediscussion/tests/functional/test_rest.py b/ForgeDiscussion/forgediscussion/tests/functional/test_rest.py
index cebce6467..5e6508728 100644
--- a/ForgeDiscussion/forgediscussion/tests/functional/test_rest.py
+++ b/ForgeDiscussion/forgediscussion/tests/functional/test_rest.py
@@ -80,7 +80,7 @@ class TestRootRestController(TestDiscussionApiBase):
assert forums[1]['num_topics'] == 0
assert (
forums[1]['url'] == 'http://localhost/rest/p/test/discussion/h%C3%A9llo/')
- assert forums[1]['last_post'] == None
+ assert forums[1]['last_post'] is None
def test_forum(self):
forum = self.api_get('/rest/p/test/discussion/general/')
@@ -255,12 +255,12 @@ class TestRootRestController(TestDiscussionApiBase):
'/rest/p/test/discussion/has_access?user=babadook&perm=read',
user='root')
assert r.status_int == 200
- assert r.json['result'] == False
+ assert r.json['result'] is False
r = self.api_get(
'/rest/p/test/discussion/has_access?user=test-user&perm=jump',
user='root')
assert r.status_int == 200
- assert r.json['result'] == False
+ assert r.json['result'] is False
def test_has_access_not_admin(self):
"""
@@ -277,9 +277,9 @@ class TestRootRestController(TestDiscussionApiBase):
'/rest/p/test/discussion/has_access?user=test-admin&perm=post',
user='root')
assert r.status_int == 200
- assert r.json['result'] == True
+ assert r.json['result'] is True
r = self.api_get(
'/rest/p/test/discussion/has_access?user=*anonymous&perm=admin',
user='root')
assert r.status_int == 200
- assert r.json['result'] == False
+ assert r.json['result'] is False
diff --git a/ForgeFiles/forgefiles/tests/functional/test_root.py b/ForgeFiles/forgefiles/tests/functional/test_root.py
index 75acf6fa2..fb38b7924 100644
--- a/ForgeFiles/forgefiles/tests/functional/test_root.py
+++ b/ForgeFiles/forgefiles/tests/functional/test_root.py
@@ -73,7 +73,7 @@ class TestFiles(TestController):
data1 = {'folder_id': str(folder_object._id), 'remarks': 'Publishing new Version'}
self.app.post('/p/test/files/publish_folder', data1)
resp = self.app.get('/files/')
- assert folder_object.published == True
+ assert folder_object.published is True
def test_link_file(self):
file_object = upload_file(self)
diff --git a/ForgeGit/forgegit/tests/functional/test_controllers.py b/ForgeGit/forgegit/tests/functional/test_controllers.py
index a906bea91..2d6b333df 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -432,7 +432,7 @@ class TestRootController(_TestCase):
r = self.app.get(ci + 'tree/',
extra_environ={'username': str(user.username)})
opts = self.subscription_options(r)
- assert opts['subscribed'] == False
+ assert opts['subscribed'] is False
# subscribe
r = self.app.post(str(ci + 'tree/subscribe'),
@@ -444,7 +444,7 @@ class TestRootController(_TestCase):
r = self.app.get(ci + 'tree/',
extra_environ={'username': str(user.username)})
opts = self.subscription_options(r)
- assert opts['subscribed'] == True
+ assert opts['subscribed'] is True
# unsubscribe
r = self.app.post(str(ci + 'tree/subscribe'),
@@ -456,7 +456,7 @@ class TestRootController(_TestCase):
r = self.app.get(ci + 'tree/',
extra_environ={'username': str(user.username)})
opts = self.subscription_options(r)
- assert opts['subscribed'] == False
+ assert opts['subscribed'] is False
def test_timezone(self):
ci = self._get_ci()
@@ -537,7 +537,7 @@ class TestRootController(_TestCase):
# for some reason c.app.config.options has old values still
app_config = M.AppConfig.query.get(_id=c.app.config._id)
assert app_config.options['external_checkout_url'] == 'http://foo.bar/baz'
- assert app_config.options['merge_disabled'] == True
+ assert app_config.options['merge_disabled'] is True
def test_refresh(self):
r = self.app.get('/p/test/src-git/refresh')
@@ -587,12 +587,12 @@ class TestHasAccessAPI(TestRestApiBase):
'/rest/p/test/src-git/has_access?user=babadook&perm=read',
user='root')
assert r.status_int == 200
- assert r.json['result'] == False
+ assert r.json['result'] is False
r = self.api_get(
'/rest/p/test/src-git/has_access?user=test-user&perm=jump',
user='root')
assert r.status_int == 200
- assert r.json['result'] == False
+ assert r.json['result'] is False
def test_has_access_not_admin(self):
"""
@@ -609,12 +609,12 @@ class TestHasAccessAPI(TestRestApiBase):
'/rest/p/test/src-git/has_access?user=test-admin&perm=create',
user='root')
assert r.status_int == 200
- assert r.json['result'] == True
+ assert r.json['result'] is True
r = self.api_get(
'/rest/p/test/src-git/has_access?user=test-user&perm=create',
user='root')
assert r.status_int == 200
- assert r.json['result'] == False
+ assert r.json['result'] is False
class TestFork(_TestCase):
@@ -1124,13 +1124,13 @@ class TestIncludeMacro(_TestCase):
setup_global_objects()
def test_parse_repo(self):
- assert macro.parse_repo('app') == None
- assert macro.parse_repo('proj:app') == None
- assert macro.parse_repo('nbhd:test:src-git') == None
- assert macro.parse_repo('a:b:c:d:e:f') == None
- assert macro.parse_repo('src-git') != None
- assert macro.parse_repo('test:src-git') != None
- assert macro.parse_repo('p:test:src-git') != None
+ assert macro.parse_repo('app') is None
+ assert macro.parse_repo('proj:app') is None
+ assert macro.parse_repo('nbhd:test:src-git') is None
+ assert macro.parse_repo('a:b:c:d:e:f') is None
+ assert macro.parse_repo('src-git') is not None
+ assert macro.parse_repo('test:src-git') is not None
+ assert macro.parse_repo('p:test:src-git') is not None
def test_include_file_no_repo(self):
expected = '[[include repo %s (not found)]]'
diff --git a/ForgeGit/forgegit/tests/model/test_repository.py b/ForgeGit/forgegit/tests/model/test_repository.py
index 8011ef145..afcb1b3ac 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -107,8 +107,8 @@ class TestNewGit(unittest.TestCase):
'/p/test/src-git/ci/'
'1e146e67985dcd71c74de79613719bef7bddca4a/')
- assert self.rev.authored_user == None
- assert self.rev.committed_user == None
+ assert self.rev.authored_user is None
+ assert self.rev.committed_user is None
user = M.User.upsert('rick')
email = user.claim_address('rcopeland@geek.net')
email.confirmed = True
@@ -558,10 +558,10 @@ By Dave Brondsema''' in text_body
os.remove(
os.path.join(tmpdir, "git/t/te/test/testgit.git/test-src-git-HEAD.zip"))
- assert self.repo.get_tarball_status('HEAD') == None
+ assert self.repo.get_tarball_status('HEAD') is None
def test_tarball_status_task(self):
- assert self.repo.get_tarball_status('HEAD') == None
+ assert self.repo.get_tarball_status('HEAD') is None
# create tarball task in MonQTask and check get_tarball_status
tarball.post('HEAD', '')
@@ -583,7 +583,7 @@ By Dave Brondsema''' in text_body
# when state is complete, but file don't exists, then status is None
task.state = 'complete'
task.query.session.flush_all()
- assert self.repo.get_tarball_status('HEAD') == None
+ assert self.repo.get_tarball_status('HEAD') is None
def test_is_empty(self):
assert not self.repo.is_empty()
@@ -715,7 +715,7 @@ By Dave Brondsema''' in text_body
git = mock.Mock()
git.merge_tree.return_value = 'clean merge'
self.repo._impl._git.git = git
- assert self.repo.can_merge(mr) == True
+ assert self.repo.can_merge(mr) is True
git.fetch.assert_called_once_with('downstream-url', 'source-branch')
git.merge_base.assert_called_once_with('cid', 'target-branch')
git.merge_tree.assert_called_once_with(
@@ -723,7 +723,7 @@ By Dave Brondsema''' in text_body
'target-branch',
'cid')
git.merge_tree.return_value = '+<<<<<<<'
- assert self.repo.can_merge(mr) == False
+ assert self.repo.can_merge(mr) is False
@mock.patch('forgegit.model.git_repo.tempfile', autospec=True)
@mock.patch('forgegit.model.git_repo.git', autospec=True)
diff --git a/ForgeImporters/forgeimporters/github/tests/test_wiki.py b/ForgeImporters/forgeimporters/github/tests/test_wiki.py
index 1ddd56d6c..3b7a7a05d 100644
--- a/ForgeImporters/forgeimporters/github/tests/test_wiki.py
+++ b/ForgeImporters/forgeimporters/github/tests/test_wiki.py
@@ -535,7 +535,7 @@ some text and **[Tips n\u2019 Tricks]**
def test_has_wiki_repo(self, repo, rmtree, mkdtemp):
mkdtemp.return_value = 'fake path'
i = GitHubWikiImporter()
- assert i.has_wiki_repo('fake url') == True
+ assert i.has_wiki_repo('fake url') is True
repo.clone_from.assert_called_once_with(
'fake url', to_path='fake path', bare=True)
rmtree.assert_called_once_with('fake path')
@@ -543,7 +543,7 @@ some text and **[Tips n\u2019 Tricks]**
def raise_error(*args, **kw):
raise git.GitCommandError('bam', 'bam', 'bam')
repo.clone_from.side_effect = raise_error
- assert i.has_wiki_repo('fake url') == False
+ assert i.has_wiki_repo('fake url') is False
class TestGitHubWikiImportController(TestController, TestCase):
diff --git a/ForgeImporters/forgeimporters/tests/github/functional/test_github.py b/ForgeImporters/forgeimporters/tests/github/functional/test_github.py
index 90f605522..f6404d758 100644
--- a/ForgeImporters/forgeimporters/tests/github/functional/test_github.py
+++ b/ForgeImporters/forgeimporters/tests/github/functional/test_github.py
@@ -61,7 +61,7 @@ class TestGitHubOAuth(TestController):
oauth.return_value = oauth_instance
user = M.User.by_username('test-admin')
- assert user.get_tool_data('GitHubProjectImport', 'token') == None
+ assert user.get_tool_data('GitHubProjectImport', 'token') is None
r = self.app.get('/p/import_project/github/')
assert r.status_int == 302
assert r.location == redirect
diff --git a/ForgeLink/forgelink/tests/functional/test_rest.py b/ForgeLink/forgelink/tests/functional/test_rest.py
index 2be487255..9747afe28 100644
--- a/ForgeLink/forgelink/tests/functional/test_rest.py
+++ b/ForgeLink/forgelink/tests/functional/test_rest.py
@@ -33,7 +33,7 @@ class TestLinkApi(TestRestApiBase):
def test_rest_link(self):
r = self.api_get('/rest/p/test/link')
- assert r.json['url'] == None
+ assert r.json['url'] is None
r = self.api_post('/rest/p/test/link',
url='http://google.com')
@@ -98,12 +98,12 @@ class TestLinkHasAccess(TestRestApiBase):
'/rest/p/test/link/has_access?user=babadook&perm=read',
user='root')
assert r.status_int == 200
- assert r.json['result'] == False
+ assert r.json['result'] is False
r = self.api_get(
'/rest/p/test/link/has_access?user=test-user&perm=jump',
user='root')
assert r.status_int == 200
- assert r.json['result'] == False
+ assert r.json['result'] is False
def test_has_access_not_admin(self):
"""
@@ -120,9 +120,9 @@ class TestLinkHasAccess(TestRestApiBase):
'/rest/p/test/link/has_access?user=test-admin&perm=configure',
user='root')
assert r.status_int == 200
- assert r.json['result'] == True
+ assert r.json['result'] is True
r = self.api_get(
'/rest/p/test/link/has_access?user=test-user&perm=configure',
user='root')
assert r.status_int == 200
- assert r.json['result'] == False
+ assert r.json['result'] is False
diff --git a/ForgeLink/forgelink/tests/functional/test_root.py b/ForgeLink/forgelink/tests/functional/test_root.py
index ac2d716cb..4748225f5 100644
--- a/ForgeLink/forgelink/tests/functional/test_root.py
+++ b/ForgeLink/forgelink/tests/functional/test_root.py
@@ -94,7 +94,7 @@ class TestConfigOptions(TestController):
assert flash['status'] == 'error'
assert flash['message'] == 'ToolError: url: That is not a valid URL'
app = self.project.app_instance('link-google')
- assert app == None
+ assert app is None
@td.with_link
def test_sets_url_on_config(self):
diff --git a/ForgeSVN/forgesvn/tests/functional/test_controllers.py b/ForgeSVN/forgesvn/tests/functional/test_controllers.py
index 99cc242ea..a337014c6 100644
--- a/ForgeSVN/forgesvn/tests/functional/test_controllers.py
+++ b/ForgeSVN/forgesvn/tests/functional/test_controllers.py
@@ -269,7 +269,7 @@ class TestRootController(SVNTestController):
assert form.find('input', attrs=dict(name='path')).get('value') == '/tags/tag-1.0'
r = self.app.get('/p/test/svn-tags/19/tarball_status?path=/tags/tag-1.0')
- assert r.json['status'] == None
+ assert r.json['status'] is None
r = self.app.post('/p/test/svn-tags/19/tarball',
dict(path='/tags/tag-1.0')).follow()
assert 'Generating snapshot...' in r
@@ -278,7 +278,7 @@ class TestRootController(SVNTestController):
assert r.json['status'] == 'complete'
r = self.app.get('/p/test/svn-tags/19/tarball_status?path=/trunk')
- assert r.json['status'] == None
+ assert r.json['status'] is None
r = self.app.post('/p/test/svn-tags/19/tarball',
dict(path='/trunk/')).follow()
assert 'Generating snapshot...' in r
@@ -287,7 +287,7 @@ class TestRootController(SVNTestController):
assert r.json['status'] == 'complete'
r = self.app.get('/p/test/svn-tags/19/tarball_status?path=/branches/aaa/')
- assert r.json['status'] == None
+ assert r.json['status'] is None
# this is is the same as trunk snapshot, so it's ready already
r = self.app.get('/p/test/svn-tags/19/tarball_status')
diff --git a/ForgeSVN/forgesvn/tests/model/test_repository.py b/ForgeSVN/forgesvn/tests/model/test_repository.py
index 707d7b52a..fcd1f6656 100644
--- a/ForgeSVN/forgesvn/tests/model/test_repository.py
+++ b/ForgeSVN/forgesvn/tests/model/test_repository.py
@@ -94,8 +94,8 @@ class TestNewRepo(unittest.TestCase):
assert self.rev.tree['a']['b']['c'].ls() == []
self.assertRaises(KeyError, lambda: self.rev.tree['a']['b']['d'])
- assert self.rev.authored_user == None
- assert self.rev.committed_user == None
+ assert self.rev.authored_user is None
+ assert self.rev.committed_user is None
assert (
sorted(self.rev.webhook_info.keys()) ==
sorted(['id', 'url', 'timestamp', 'message', 'author',
diff --git a/ForgeTracker/forgetracker/tests/functional/test_rest.py b/ForgeTracker/forgetracker/tests/functional/test_rest.py
index 6dfa4c9eb..85cfc77eb 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_rest.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_rest.py
@@ -88,13 +88,13 @@ class TestRestNewTicket(TestTrackerApiBase):
summary = 'Second ticket'
self.create_ticket(summary=summary)
t = TM.Ticket.query.get(summary=summary)
- assert t != None
+ assert t is not None
# Set rate limit to 1 in first hour of project
with h.push_config(config, **{'forgetracker.rate_limits': '{"3600": 1}'}):
summary = 'Third ticket'
self.create_ticket(summary=summary, status=429)
t = TM.Ticket.query.get(summary=summary)
- assert t == None
+ assert t is None
class TestRestUpdateTicket(TestTrackerApiBase):
@@ -252,12 +252,12 @@ class TestRestHasAccess(TestTrackerApiBase):
'/rest/p/test/bugs/has_access?user=babadook&perm=read',
user='root')
assert r.status_int == 200
- assert r.json['result'] == False
+ assert r.json['result'] is False
r = self.api_get(
'/rest/p/test/bugs/has_access?user=test-user&perm=jump',
user='root')
assert r.status_int == 200
- assert r.json['result'] == False
+ assert r.json['result'] is False
def test_has_access_not_admin(self):
"""
@@ -274,9 +274,9 @@ class TestRestHasAccess(TestTrackerApiBase):
'/rest/p/test/bugs/has_access?user=test-admin&perm=delete',
user='root')
assert r.status_int == 200
- assert r.json['result'] == True
+ assert r.json['result'] is True
r = self.api_get(
'/rest/p/test/bugs/has_access?user=test-user&perm=delete',
user='root')
assert r.status_int == 200
- assert r.json['result'] == False
+ assert r.json['result'] is False
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index 129198ae6..28d2c0742 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -296,7 +296,7 @@ class TestFunctionalController(TrackerTestController):
ticket_view = self.new_ticket(summary=summary).follow()
assert summary in ticket_view
opts = self.subscription_options(ticket_view)
- assert opts['subscribed'] == False
+ assert opts['subscribed'] is False
def test_ticket_get_markdown(self):
self.new_ticket(summary='my ticket', description='my description')
@@ -406,7 +406,7 @@ class TestFunctionalController(TrackerTestController):
assert form['ticket_form.assigned_to'].value == 'test-user'
assert form['ticket_form._milestone'].value == '2.0'
assert form['ticket_form.status'].value == 'pending'
- assert form['ticket_form.private'].checked == True
+ assert form['ticket_form.private'].checked is True
def test_mass_edit(self):
self.new_ticket(summary='First Ticket').follow()
@@ -515,8 +515,8 @@ class TestFunctionalController(TrackerTestController):
'summary': 'First Custom'}).first()
ticket2 = tm.Ticket.query.find({
'summary': 'Second Custom'}).first()
- assert ticket1.custom_fields._major == False
- assert ticket2.custom_fields._major == False
+ assert ticket1.custom_fields._major is False
+ assert ticket2.custom_fields._major is False
self.app.post('/p/test/bugs/update_tickets', {
'__search': '',
@@ -533,8 +533,8 @@ class TestFunctionalController(TrackerTestController):
assert '<li><strong>Major</strong>: False --> True</li>' in r
ticket1 = tm.Ticket.query.find({'summary': 'First Custom'}).first()
ticket2 = tm.Ticket.query.find({'summary': 'Second Custom'}).first()
- assert ticket1.custom_fields._major == True
- assert ticket2.custom_fields._major == True
+ assert ticket1.custom_fields._major is True
+ assert ticket2.custom_fields._major is True
self.app.post('/p/test/bugs/update_tickets', {
'__search': '',
@@ -545,7 +545,7 @@ class TestFunctionalController(TrackerTestController):
M.MonQTask.run_ready()
ticket2 = tm.Ticket.query.find({
'summary': 'Second Custom'}).first()
- assert ticket2.custom_fields._major == False
+ assert ticket2.custom_fields._major is False
self.app.post('/p/test/bugs/update_tickets', {
'__search': '',
'__ticket_ids': (
@@ -557,8 +557,8 @@ class TestFunctionalController(TrackerTestController):
M.MonQTask.run_ready()
ticket1 = tm.Ticket.query.find({'summary': 'First Custom'}).first()
ticket2 = tm.Ticket.query.find({'summary': 'Second Custom'}).first()
- assert ticket1.custom_fields._major == True
- assert ticket2.custom_fields._major == False
+ assert ticket1.custom_fields._major is True
+ assert ticket2.custom_fields._major is False
def test_mass_edit_select_options_split(self):
params = dict(
@@ -604,8 +604,8 @@ class TestFunctionalController(TrackerTestController):
assert '<li><strong>Private</strong>: No --> Yes</li>' not in r
ticket1 = tm.Ticket.query.find({'summary': 'First'}).first()
ticket2 = tm.Ticket.query.find({'summary': 'Second'}).first()
- assert ticket1.private == False
- assert ticket2.private == False
+ assert ticket1.private is False
+ assert ticket2.private is False
self.app.post('/p/test/bugs/update_tickets', {
'__search': '',
@@ -621,8 +621,8 @@ class TestFunctionalController(TrackerTestController):
assert '<li><strong>Private</strong>: No --> Yes</li>' in r
ticket1 = tm.Ticket.query.find({'summary': 'First'}).first()
ticket2 = tm.Ticket.query.find({'summary': 'Second'}).first()
- assert ticket1.private == True
- assert ticket2.private == True
+ assert ticket1.private is True
+ assert ticket2.private is True
ticket2.private = False
self.app.post('/p/test/bugs/update_tickets', {
@@ -635,8 +635,8 @@ class TestFunctionalController(TrackerTestController):
M.MonQTask.run_ready()
ticket1 = tm.Ticket.query.find({'summary': 'First'}).first()
ticket2 = tm.Ticket.query.find({'summary': 'Second'}).first()
- assert ticket1.private == True
- assert ticket2.private == False
+ assert ticket1.private is True
+ assert ticket2.private is False
def test_private_ticket(self):
ticket_view = self.new_ticket(summary='Public Ticket').follow()
@@ -2568,7 +2568,7 @@ class TestFunctionalController(TrackerTestController):
r = self.app.post('/bugs/save_ticket', post_data).follow()
assert summary in r
t = tm.Ticket.query.get(summary=summary)
- assert t != None
+ assert t is not None
# Set rate limit to 1 in first hour of project
with h.push_config(config, **{'forgetracker.rate_limits': '{"3600": 1}'}):
summary = 'Ticket with limit'
@@ -2583,7 +2583,7 @@ class TestFunctionalController(TrackerTestController):
'Ticket creation rate limit exceeded. Please try again later.')
assert summary not in r.follow()
t = tm.Ticket.query.get(summary=summary)
- assert t == None
+ assert t is None
def test_user_missing(self):
# add test-user to project so it can be assigned the ticket
@@ -3307,7 +3307,7 @@ class TestNotificationEmailGrouping(TrackerTestController):
email = M.MonQTask.query.find(dict(task_name='allura.tasks.mail_tasks.sendmail')).first()
ticket = tm.Ticket.query.get(ticket_num=1)
assert email.kwargs.message_id == ticket.message_id()
- assert email.kwargs.in_reply_to == None
+ assert email.kwargs.in_reply_to is None
assert email.kwargs.references == []
def test_comments(self):
diff --git a/ForgeTracker/forgetracker/tests/test_app.py b/ForgeTracker/forgetracker/tests/test_app.py
index f5542b602..66d8af6e5 100644
--- a/ForgeTracker/forgetracker/tests/test_app.py
+++ b/ForgeTracker/forgetracker/tests/test_app.py
@@ -64,7 +64,7 @@ class TestApp:
c.app.handle_message('6789', msg)
# no new message
post = M.Post.query.get(_id=message_id)
- assert post == None
+ assert post is None
@td.with_tracker
def test_uninstall(self):
diff --git a/ForgeTracker/forgetracker/tests/unit/test_globals_model.py b/ForgeTracker/forgetracker/tests/unit/test_globals_model.py
index 2e7c591a3..0b508fc60 100644
--- a/ForgeTracker/forgetracker/tests/unit/test_globals_model.py
+++ b/ForgeTracker/forgetracker/tests/unit/test_globals_model.py
@@ -132,7 +132,7 @@ class TestGlobalsModel(TrackerTestWithModel):
forgetracker.model.Ticket, 'bar', rows=0, short_timeout=False, fq=['-deleted_b:true'])
assert gbl._bin_counts_data == [{'summary': 'foo', 'hits': 5}]
assert gbl._bin_counts_expire == now + timedelta(minutes=60)
- assert gbl._bin_counts_invalidated == None
+ assert gbl._bin_counts_invalidated is None
def test_append_new_labels(self):
gbl = Globals()
diff --git a/ForgeTracker/forgetracker/tests/unit/test_ticket_model.py b/ForgeTracker/forgetracker/tests/unit/test_ticket_model.py
index 940525363..100b1fe7f 100644
--- a/ForgeTracker/forgetracker/tests/unit/test_ticket_model.py
+++ b/ForgeTracker/forgetracker/tests/unit/test_ticket_model.py
@@ -294,7 +294,7 @@ class TestTicketModel(TrackerTestWithModel):
ticket.assigned_to_id = User.by_username('test-user-0')._id
t = ticket.move(app2.config)
- assert t.assigned_to_id == None
+ assert t.assigned_to_id is None
assert t.custom_fields['_user_field'] == 'test-user'
assert t.custom_fields['_user_field_2'] == ''
post = Post.query.find(
@@ -359,4 +359,4 @@ class TestTicketModel(TrackerTestWithModel):
assert idx['summary_t'] == 'ticket2'
assert idx['labels_t'] == 'mylabel other'
assert idx['reported_by_s'] == 'test-user'
- assert idx['assigned_to_s'] == None # must exist at least
+ assert idx['assigned_to_s'] is None # must exist at least
diff --git a/ForgeWiki/forgewiki/tests/functional/test_rest.py b/ForgeWiki/forgewiki/tests/functional/test_rest.py
index 0703f7e39..e75a911a5 100644
--- a/ForgeWiki/forgewiki/tests/functional/test_rest.py
+++ b/ForgeWiki/forgewiki/tests/functional/test_rest.py
@@ -94,12 +94,12 @@ class TestWikiApi(TestRestApiBase):
with h.push_config(tg.config, **{'forgewiki.rate_limits': '{}'}):
r = self.api_post('/rest/p/test/wiki/page1/', status=200, **data)
p = Page.query.get(title='page1')
- assert p != None
+ assert p is not None
# Set rate limit to 1 in first hour of project
with h.push_config(tg.config, **{'forgewiki.rate_limits': '{"3600": 1}'}):
r = self.api_post('/rest/p/test/wiki/page2/', status=429, **data)
p = Page.query.get(title='page2')
- assert p == None
+ assert p is None
# http://blog.watchfire.com/wfblog/2011/10/json-based-xss-exploitation.html
def test_json_encoding_security(self):
@@ -139,12 +139,12 @@ class TestWikiHasAccess(TestRestApiBase):
'/rest/p/test/wiki/has_access?user=babadook&perm=read',
user='root')
assert r.status_int == 200
- assert r.json['result'] == False
+ assert r.json['result'] is False
r = self.api_get(
'/rest/p/test/wiki/has_access?user=test-user&perm=jump',
user='root')
assert r.status_int == 200
- assert r.json['result'] == False
+ assert r.json['result'] is False
def test_has_access_not_admin(self):
"""
@@ -161,9 +161,9 @@ class TestWikiHasAccess(TestRestApiBase):
'/rest/p/test/wiki/has_access?user=test-admin&perm=create',
user='root')
assert r.status_int == 200
- assert r.json['result'] == True
+ assert r.json['result'] is True
r = self.api_get(
'/rest/p/test/wiki/has_access?user=test-user&perm=create',
user='root')
assert r.status_int == 200
- assert r.json['result'] == False
+ assert r.json['result'] is False
diff --git a/ForgeWiki/forgewiki/tests/functional/test_root.py b/ForgeWiki/forgewiki/tests/functional/test_root.py
index 8a5e5eee2..b4c20af97 100644
--- a/ForgeWiki/forgewiki/tests/functional/test_root.py
+++ b/ForgeWiki/forgewiki/tests/functional/test_root.py
@@ -900,7 +900,7 @@ class TestRootController(TestController):
dict(text='Some text', title='page1')).follow()
assert 'Some text' in r
p = model.Page.query.get(title='page1')
- assert p != None
+ assert p is not None
# Set rate limit to 1 in first hour of project
with h.push_config(config, **{'forgewiki.rate_limits': '{"3600": 1}'}):
r = self.app.post(
@@ -914,7 +914,7 @@ class TestRootController(TestController):
wf['message'] ==
'Page create/edit rate limit exceeded. Please try again later.')
p = model.Page.query.get(title='page2')
- assert p == None
+ assert p is None
def test_rate_limit_by_user(self):
# also test that multiple edits to a page counts as one page towards the limit
@@ -960,7 +960,7 @@ class TestRootController(TestController):
env = {'username': str(username)}
r = self.app.get('/p/test/wiki/Home/', extra_environ=env)
menu = r.html.find('div', {'id': 'sidebar-admin-menu'})
- assert menu == None
+ assert menu is None
assert_invisible_for('*anonymous')
assert_invisible_for('test-user')
[allura] 04/06: allow and do not change the order of these imports
Posted by br...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
brondsem pushed a commit to branch db/pep8_nov2022
in repository https://gitbox.apache.org/repos/asf/allura.git
commit c51a00794a2e9b4465427750f6a9cba8fe878311
Author: Dave Brondsema <db...@slashdotmedia.com>
AuthorDate: Wed Nov 9 16:28:55 2022 -0500
allow and do not change the order of these imports
---
Allura/allura/config/middleware.py | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/Allura/allura/config/middleware.py b/Allura/allura/config/middleware.py
index 2d759c4d8..d948706ab 100644
--- a/Allura/allura/config/middleware.py
+++ b/Allura/allura/config/middleware.py
@@ -51,21 +51,21 @@ except ImportError:
else:
patches.newrelic()
-from allura.config.app_cfg import base_config, AlluraJinjaRenderer
-from allura.config.environment import load_environment
-from allura.config.app_cfg import ForgeConfig
-from allura.lib.custom_middleware import AlluraTimerMiddleware
-from allura.lib.custom_middleware import SSLMiddleware
-from allura.lib.custom_middleware import StaticFilesMiddleware
-from allura.lib.custom_middleware import CSRFMiddleware
-from allura.lib.custom_middleware import CORSMiddleware
-from allura.lib.custom_middleware import LoginRedirectMiddleware
-from allura.lib.custom_middleware import RememberLoginMiddleware
-from allura.lib.custom_middleware import SetRequestHostFromConfig
-from allura.lib.custom_middleware import MingTaskSessionSetupMiddleware
-from allura.lib.custom_middleware import ContentSecurityPolicyMiddleware
-from allura.lib import helpers as h
-from allura.lib.utils import configure_ming
+from allura.config.app_cfg import base_config, AlluraJinjaRenderer # noqa: E402
+from allura.config.environment import load_environment # noqa: E402
+from allura.config.app_cfg import ForgeConfig # noqa: E402
+from allura.lib.custom_middleware import AlluraTimerMiddleware # noqa: E402
+from allura.lib.custom_middleware import SSLMiddleware # noqa: E402
+from allura.lib.custom_middleware import StaticFilesMiddleware # noqa: E402
+from allura.lib.custom_middleware import CSRFMiddleware # noqa: E402
+from allura.lib.custom_middleware import CORSMiddleware # noqa: E402
+from allura.lib.custom_middleware import LoginRedirectMiddleware # noqa: E402
+from allura.lib.custom_middleware import RememberLoginMiddleware # noqa: E402
+from allura.lib.custom_middleware import SetRequestHostFromConfig # noqa: E402
+from allura.lib.custom_middleware import MingTaskSessionSetupMiddleware # noqa: E402
+from allura.lib.custom_middleware import ContentSecurityPolicyMiddleware # noqa: E402
+from allura.lib import helpers as h # noqa: E402
+from allura.lib.utils import configure_ming # noqa: E402
__all__ = ['make_app']
[allura] 02/06: convert "assert not foo in bar" to "assert foo not in bar"
Posted by br...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
brondsem pushed a commit to branch db/pep8_nov2022
in repository https://gitbox.apache.org/repos/asf/allura.git
commit a82d43f2e82c84bf6b00b8d818641d76e1ca13a4
Author: Dave Brondsema <db...@slashdotmedia.com>
AuthorDate: Wed Nov 9 16:16:23 2022 -0500
convert "assert not foo in bar" to "assert foo not in bar"
---
ForgeTracker/forgetracker/tests/functional/test_root.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index 28d2c0742..5c082033e 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -760,7 +760,7 @@ class TestFunctionalController(TrackerTestController):
assert sidebar_contains(index_view, '<span>1.0</span>')
index_view = self.app.get('/bugs/')
assert sidebar_contains(index_view, '<span>1.0</span>')
- assert not summary in index_view
+ assert summary not in index_view
def test_render_ticket(self):
summary = 'test render ticket'
@@ -1579,7 +1579,7 @@ class TestFunctionalController(TrackerTestController):
r = self.app.get('/bugs/1/', dict(page='1'))
assert post_content in r
# no pager if just one page
- assert not 'Page 1 of 1' in r
+ assert 'Page 1 of 1' not in r
# add some more posts and check for pager
for i in range(2):
r = self.app.post(f['action'], params=params,
@@ -1679,7 +1679,7 @@ class TestFunctionalController(TrackerTestController):
ticket_rows = response.html.find('table', {'class': 'ticket-list'}).find('tbody')
assert 'test first ticket' in ticket_rows.text
assert 'test second ticket' in ticket_rows.text
- assert not 'test third ticket' in ticket_rows.text
+ assert 'test third ticket' not in ticket_rows.text
edit_link = response.html.find('a', {'title': 'Bulk Edit'})
expected_link = "/p/test/bugs/edit/?q=status%3Aopen&limit=25&filter=%7B%7D&page=0"
assert_equivalent_urls(expected_link, edit_link['href'])
@@ -1687,7 +1687,7 @@ class TestFunctionalController(TrackerTestController):
ticket_rows = response.html.find('tbody', {'class': 'ticket-list'})
assert 'test first ticket' in ticket_rows.text
assert 'test second ticket' in ticket_rows.text
- assert not 'test third ticket' in ticket_rows.text
+ assert 'test third ticket' not in ticket_rows.text
def test_bulk_edit_after_filtering(self):
self.new_ticket(summary='test first ticket', status='open')
[allura] 03/06: change [pep8] to [pycodestyle]
Posted by br...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
brondsem pushed a commit to branch db/pep8_nov2022
in repository https://gitbox.apache.org/repos/asf/allura.git
commit be3e33e2810fc0689516185c1fabea64343f967a
Author: Dave Brondsema <db...@slashdotmedia.com>
AuthorDate: Wed Nov 9 16:19:03 2022 -0500
change [pep8] to [pycodestyle]
---
Allura/setup.cfg | 2 +-
AlluraTest/setup.cfg | 2 +-
ForgeActivity/setup.cfg | 2 +-
ForgeBlog/setup.cfg | 2 +-
ForgeChat/setup.cfg | 2 +-
ForgeDiscussion/setup.cfg | 2 +-
ForgeFeedback/setup.cfg | 2 +-
ForgeFiles/setup.cfg | 2 +-
ForgeGit/setup.cfg | 2 +-
ForgeImporters/setup.cfg | 2 +-
ForgeLink/setup.cfg | 2 +-
ForgeSVN/setup.cfg | 2 +-
ForgeShortUrl/setup.cfg | 2 +-
ForgeTracker/setup.cfg | 2 +-
ForgeUserStats/setup.cfg | 2 +-
ForgeWiki/setup.cfg | 2 +-
setup.cfg | 2 +-
17 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/Allura/setup.cfg b/Allura/setup.cfg
index 3398fc4e9..453efd7e3 100644
--- a/Allura/setup.cfg
+++ b/Allura/setup.cfg
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-[pep8]
+[pycodestyle]
max-line-length = 119
[flake8]
diff --git a/AlluraTest/setup.cfg b/AlluraTest/setup.cfg
index 14bf9ca18..dc59fc75c 100644
--- a/AlluraTest/setup.cfg
+++ b/AlluraTest/setup.cfg
@@ -1,4 +1,4 @@
-[pep8]
+[pycodestyle]
max-line-length = 119
[flake8]
diff --git a/ForgeActivity/setup.cfg b/ForgeActivity/setup.cfg
index 989542f50..c86f54040 100644
--- a/ForgeActivity/setup.cfg
+++ b/ForgeActivity/setup.cfg
@@ -1,4 +1,4 @@
-[pep8]
+[pycodestyle]
max-line-length = 119
[flake8]
diff --git a/ForgeBlog/setup.cfg b/ForgeBlog/setup.cfg
index 0f1091a87..1f0e936bc 100644
--- a/ForgeBlog/setup.cfg
+++ b/ForgeBlog/setup.cfg
@@ -1,4 +1,4 @@
-[pep8]
+[pycodestyle]
max-line-length = 119
[flake8]
diff --git a/ForgeChat/setup.cfg b/ForgeChat/setup.cfg
index 62fb31052..80089c8d0 100644
--- a/ForgeChat/setup.cfg
+++ b/ForgeChat/setup.cfg
@@ -1,4 +1,4 @@
-[pep8]
+[pycodestyle]
max-line-length = 119
[flake8]
diff --git a/ForgeDiscussion/setup.cfg b/ForgeDiscussion/setup.cfg
index cad5dc70e..491caac9a 100644
--- a/ForgeDiscussion/setup.cfg
+++ b/ForgeDiscussion/setup.cfg
@@ -1,4 +1,4 @@
-[pep8]
+[pycodestyle]
max-line-length = 119
[flake8]
diff --git a/ForgeFeedback/setup.cfg b/ForgeFeedback/setup.cfg
index feae30657..e04e3e8e2 100644
--- a/ForgeFeedback/setup.cfg
+++ b/ForgeFeedback/setup.cfg
@@ -1,4 +1,4 @@
-[pep8]
+[pycodestyle]
max-line-length = 119
[flake8]
diff --git a/ForgeFiles/setup.cfg b/ForgeFiles/setup.cfg
index 1181fa30b..bbcd097b4 100644
--- a/ForgeFiles/setup.cfg
+++ b/ForgeFiles/setup.cfg
@@ -1,4 +1,4 @@
-[pep8]
+[pycodestyle]
max-line-length = 119
[flake8]
diff --git a/ForgeGit/setup.cfg b/ForgeGit/setup.cfg
index 5b182c6a5..a7e174e4e 100644
--- a/ForgeGit/setup.cfg
+++ b/ForgeGit/setup.cfg
@@ -1,4 +1,4 @@
-[pep8]
+[pycodestyle]
max-line-length = 119
[flake8]
diff --git a/ForgeImporters/setup.cfg b/ForgeImporters/setup.cfg
index c66965b0b..2d063f9d1 100644
--- a/ForgeImporters/setup.cfg
+++ b/ForgeImporters/setup.cfg
@@ -1,4 +1,4 @@
-[pep8]
+[pycodestyle]
max-line-length = 119
[flake8]
diff --git a/ForgeLink/setup.cfg b/ForgeLink/setup.cfg
index 580ae47c7..8b29b373a 100644
--- a/ForgeLink/setup.cfg
+++ b/ForgeLink/setup.cfg
@@ -1,4 +1,4 @@
-[pep8]
+[pycodestyle]
max-line-length = 119
[flake8]
diff --git a/ForgeSVN/setup.cfg b/ForgeSVN/setup.cfg
index 2eced00fe..479785ef8 100644
--- a/ForgeSVN/setup.cfg
+++ b/ForgeSVN/setup.cfg
@@ -1,4 +1,4 @@
-[pep8]
+[pycodestyle]
max-line-length = 119
[flake8]
diff --git a/ForgeShortUrl/setup.cfg b/ForgeShortUrl/setup.cfg
index dcf13118b..6798578f6 100644
--- a/ForgeShortUrl/setup.cfg
+++ b/ForgeShortUrl/setup.cfg
@@ -1,4 +1,4 @@
-[pep8]
+[pycodestyle]
max-line-length = 119
[flake8]
diff --git a/ForgeTracker/setup.cfg b/ForgeTracker/setup.cfg
index e9b9a0c7b..8551d861d 100644
--- a/ForgeTracker/setup.cfg
+++ b/ForgeTracker/setup.cfg
@@ -1,4 +1,4 @@
-[pep8]
+[pycodestyle]
max-line-length = 119
[flake8]
diff --git a/ForgeUserStats/setup.cfg b/ForgeUserStats/setup.cfg
index f25f83d83..a208f628e 100644
--- a/ForgeUserStats/setup.cfg
+++ b/ForgeUserStats/setup.cfg
@@ -1,4 +1,4 @@
-[pep8]
+[pycodestyle]
max-line-length = 119
[flake8]
diff --git a/ForgeWiki/setup.cfg b/ForgeWiki/setup.cfg
index 7e4ece29d..5a71cb269 100644
--- a/ForgeWiki/setup.cfg
+++ b/ForgeWiki/setup.cfg
@@ -1,4 +1,4 @@
-[pep8]
+[pycodestyle]
max-line-length = 119
[flake8]
diff --git a/setup.cfg b/setup.cfg
index 1ba576aeb..ed6ec68d5 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-[pep8]
+[pycodestyle]
max-line-length = 119
[flake8]
[allura] 06/06: ignore a pure reformatting change
Posted by br...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
brondsem pushed a commit to branch db/pep8_nov2022
in repository https://gitbox.apache.org/repos/asf/allura.git
commit e7f78cec43e81e4020072207e12642a2bbf24dd8
Author: Dave Brondsema <db...@slashdotmedia.com>
AuthorDate: Wed Nov 9 16:35:02 2022 -0500
ignore a pure reformatting change
---
.git-blame-ignore-revs | 1 +
1 file changed, 1 insertion(+)
diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs
index d0246d15f..0a6818042 100644
--- a/.git-blame-ignore-revs
+++ b/.git-blame-ignore-revs
@@ -25,3 +25,4 @@ f7bd15435448e354c7eb60cb9d60d513ef0f79d7
c93733acb492b4c9238ac8ec32136bb95f1a87d9
279efb75ca590dacc63caeb30ce7e01667b0eeeb
72b8ee3d0edc61e564a866dd14415d433bbdfb17
+b5a3bcba5f027bf80e8938af21df305f4090d8a7
\ No newline at end of file
[allura] 05/06: autopep8 -i --max-line-length 9999 on many files
Posted by br...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
brondsem pushed a commit to branch db/pep8_nov2022
in repository https://gitbox.apache.org/repos/asf/allura.git
commit b5a3bcba5f027bf80e8938af21df305f4090d8a7
Author: Dave Brondsema <db...@slashdotmedia.com>
AuthorDate: Wed Nov 9 16:29:12 2022 -0500
autopep8 -i --max-line-length 9999 on many files
---
Allura/allura/controllers/repository.py | 15 +++---
Allura/allura/lib/helpers.py | 14 +++--
Allura/allura/lib/widgets/forms.py | 18 +++----
Allura/allura/tests/functional/test_admin.py | 26 ++++-----
Allura/allura/tests/functional/test_home.py | 34 ++++++------
Allura/allura/tests/test_globals.py | 62 +++++++++++-----------
Allura/allura/tests/test_helpers.py | 36 ++++++-------
Allura/allura/tests/test_plugin.py | 12 ++---
Allura/allura/tests/test_security.py | 16 +++---
Allura/allura/tests/test_utils.py | 11 ++--
AlluraTest/alluratest/controller.py | 12 +++--
.../forgeactivity/tests/functional/test_root.py | 20 +++----
.../forgegit/tests/functional/test_controllers.py | 36 ++++++-------
.../forgeimporters/github/tests/test_wiki.py | 20 +++----
.../forgesvn/tests/functional/test_controllers.py | 14 ++---
ForgeSVN/forgesvn/tests/model/test_repository.py | 26 ++++-----
ForgeTracker/forgetracker/model/ticket.py | 18 +++----
.../forgetracker/tests/functional/test_root.py | 48 ++++++++---------
...34-update_subscriptions_ticket_and_mr_titles.py | 6 +--
19 files changed, 229 insertions(+), 215 deletions(-)
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index 0dae4b49f..cb9cad866 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -104,7 +104,7 @@ class RepoRootController(BaseController, FeedController):
links.append(dict(
repo_url=f.url(),
repo='{} / {}'.format(repo_path_parts[1],
- repo_path_parts[-1]),
+ repo_path_parts[-1]),
))
return dict(links=links)
@@ -130,7 +130,7 @@ class RepoRootController(BaseController, FeedController):
from_project = c.project
to_project = M.Project.query.get(_id=ObjectId(project_id))
mount_label = mount_label or '{} - {}'.format(c.project.name,
- c.app.config.options.mount_label)
+ c.app.config.options.mount_label)
mount_point = (mount_point or from_project.shortname)
if request.method != 'POST' or not mount_point:
return dict(from_repo=from_repo,
@@ -361,12 +361,13 @@ class RepoRestController(RepoRootController, AppRestControllerMixin):
}
for commit in revisions
]}
+
@expose('json:')
def commit_status(self, rev=None, **kwargs):
if not g.commit_statuses_enabled:
return {'status': 'disabled', 'message': 'check your config file'}
- params = {x : kwargs.get(x, '').strip() for x in
- ['state', 'target_url', 'description', 'context']}
+ params = {x: kwargs.get(x, '').strip() for x in
+ ['state', 'target_url', 'description', 'context']}
params['commit_id'] = rev
status = M.CommitStatus.upsert(**params)
response = {'status': 'error'}
@@ -375,7 +376,6 @@ class RepoRestController(RepoRootController, AppRestControllerMixin):
return response
-
class MergeRequestsController:
@with_trailing_slash
@@ -949,7 +949,7 @@ class FileBrowser(BaseController):
if not self._blob.has_html_view:
diff = "Cannot display: file marked as a binary type."
return dict(a=a, b=b, diff=diff)
-
+
if max(a.size, b.size) > asint(tg.config.get('scm.view.max_diff_bytes', 2000000)):
# have to check the original file size, not diff size, because difflib._mdiff inside HtmlSideBySideDiff
# can take an extremely long time on large files (and its even a generator)
@@ -967,7 +967,7 @@ class FileBrowser(BaseController):
else:
web_session['diformat'] = fmt
web_session.save()
-
+
if fmt == 'sidebyside':
hd = HtmlSideBySideDiff()
diff = hd.make_table(la, lb, adesc, bdesc)
@@ -999,4 +999,5 @@ def topo_sort(children, parents, dates, head_ids):
else:
to_visit.append(p)
+
on_import()
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index da5f3e954..51d867ebc 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -178,9 +178,11 @@ def querystring(request, url_params):
url = url_parts._replace(query=urlencode(params)).geturl()
return url
+
def ceil(number):
return math.ceil(number)
+
def strip_bad_unicode(s):
"""
xml doesn't like some control characters: https://www.w3.org/TR/REC-xml/#charsets
@@ -251,6 +253,7 @@ def really_unicode(s):
# default case. Also lets Markup() instances be preserved
return s
# Try to guess the encoding
+
def encodings():
yield None
yield 'utf-8'
@@ -656,6 +659,7 @@ class fixed_attrs_proxy(proxy):
provided during object construction, returns it's value. Otherwise proxies
to obj.
"""
+
def __init__(self, obj, **kw):
self._obj = obj
for k, v in kw.items():
@@ -695,7 +699,7 @@ def config_with_prefix(d, prefix):
'''
plen = len(prefix)
return {k[plen:]: v for k, v in d.items()
- if k.startswith(prefix)}
+ if k.startswith(prefix)}
def paging_sanitizer(limit, page, total_count=sys.maxsize, zero_based_pages=True):
@@ -781,12 +785,14 @@ def render_any_markup(name, txt, code_mode=False, linenumbers_style=TABLE):
txt = '<pre>%s</pre>' % txt
return Markup(txt)
+
@pass_context
def subrender_jinja_filter(context, value):
_template = context.eval_ctx.environment.from_string(value)
result = _template.render(**context)
return result
+
def nl2br_jinja_filter(value):
result = '<br>\n'.join(escape(line) for line in value.split('\n'))
return Markup(result)
@@ -1267,8 +1273,8 @@ def slugify(name, allow_periods=False):
"""
RE_NON_ALPHA_ETC = re.compile(r'[^.\w]+' if allow_periods else r'[^\w]+')
slug = RE_NON_ALPHA_ETC.sub('-', # replace non ". alphanum_" sequences into single -
- unicodedata.normalize('NFKD', name).encode('ascii', 'ignore').decode().replace("'", '') # asciify & strip apostophes. https://stackoverflow.com/a/53261200
- ).strip('-') # leading - or trailing - gets removed
+ unicodedata.normalize('NFKD', name).encode('ascii', 'ignore').decode().replace("'", '') # asciify & strip apostophes. https://stackoverflow.com/a/53261200
+ ).strip('-') # leading - or trailing - gets removed
return slug, slug.lower()
@@ -1323,7 +1329,7 @@ def username_project_url(user_or_username):
return f'{url}profile/'
-def pluralize_tool_name(tool_name:string, count:int):
+def pluralize_tool_name(tool_name: string, count: int):
pluralize_tools = ['Wiki', 'Discussion', 'Blog']
if tool_name is not None and tool_name in pluralize_tools:
return f"{tool_name}{'s'[:count^1]}"
diff --git a/Allura/allura/lib/widgets/forms.py b/Allura/allura/lib/widgets/forms.py
index bd1ab5e0e..69bf853cd 100644
--- a/Allura/allura/lib/widgets/forms.py
+++ b/Allura/allura/lib/widgets/forms.py
@@ -119,7 +119,7 @@ class ForgeForm(ew.SimpleForm):
display = field.display(**ctx)
if ctx['errors'] and field.show_errors and not ignore_errors:
display = "{}<div class='error'>{}</div>".format(display,
- ctx['errors'])
+ ctx['errors'])
return Markup(display)
@@ -498,9 +498,9 @@ class AddInactivePeriodForm(ForgeForm):
def to_python(self, kw, state):
d = super().to_python(kw, state)
if d['startdate'] > d['enddate']:
- raise formencode.Invalid(
- 'Invalid period: start date greater than end date.',
- kw, state)
+ raise formencode.Invalid(
+ 'Invalid period: start date greater than end date.',
+ kw, state)
return d
@@ -557,9 +557,9 @@ class AddTimeSlotForm(ForgeForm):
d = super().to_python(kw, state)
if (d['starttime']['h'], d['starttime']['m']) > \
(d['endtime']['h'], d['endtime']['m']):
- raise formencode.Invalid(
- 'Invalid period: start time greater than end time.',
- kw, state)
+ raise formencode.Invalid(
+ 'Invalid period: start time greater than end time.',
+ kw, state)
return d
@@ -618,7 +618,7 @@ class RemoveTroveCategoryForm(ForgeForm):
href="/categories/%s" % cat.trove_cat_id),
ew.HTMLField(
text=cat.shortname,
- attrs={'disabled':True, 'value':cat.shortname}),
+ attrs={'disabled': True, 'value': cat.shortname}),
ew.SubmitButton(
show_errors=False,
attrs={'value': 'Remove'})],
@@ -874,7 +874,7 @@ class NeighborhoodOverviewForm(ForgeForm):
if ctx['errors'] and field.show_errors and not ignore_errors:
display = "{}<div class='error'>{}</div>".format(display,
- ctx['errors'])
+ ctx['errors'])
return Markup(display)
else:
diff --git a/Allura/allura/tests/functional/test_admin.py b/Allura/allura/tests/functional/test_admin.py
index c0a879c3f..c1d71bd72 100644
--- a/Allura/allura/tests/functional/test_admin.py
+++ b/Allura/allura/tests/functional/test_admin.py
@@ -453,7 +453,7 @@ class TestProjectAdmin(TestController):
assert screenshots[0].filename == 'admin_24.png'
# reverse order
params = {str(ss._id): str(len(screenshots) - 1 - i)
- for i, ss in enumerate(screenshots)}
+ for i, ss in enumerate(screenshots)}
self.app.post('/admin/sort_screenshots', params)
assert project.get_screenshots()[0].filename == 'admin_32.png'
@@ -979,7 +979,7 @@ class TestExport(TestController):
r = self.app.get('/admin/export',
extra_environ={'username': '*anonymous'}).follow()
assert (r.request.url ==
- 'http://localhost/auth/?return_to=%2Fadmin%2Fexport')
+ 'http://localhost/auth/?return_to=%2Fadmin%2Fexport')
self.app.get('/admin/export',
extra_environ={'username': 'test-user'},
status=403)
@@ -1017,7 +1017,7 @@ class TestExport(TestController):
exportable_mount_points = [
t.options.mount_point for t in exportable_tools]
assert (exportable_mount_points ==
- ['admin', 'search', 'wiki', 'wiki2'])
+ ['admin', 'search', 'wiki', 'wiki2'])
def test_tools_not_selected(self):
r = self.app.post('/admin/export')
@@ -1055,7 +1055,7 @@ class TestExport(TestController):
def test_bulk_export_path_for_user_project(self):
project = M.Project.query.get(shortname='u/test-user')
assert (project.bulk_export_path(tg.config['bulk_export_path']) ==
- '/tmp/bulk_export/u/test-user')
+ '/tmp/bulk_export/u/test-user')
@td.with_user_project('test-user')
def test_bulk_export_filename_for_user_project(self):
@@ -1177,7 +1177,7 @@ class TestRestInstallTool(TestRestApiBase):
r = self.api_post('/rest/p/test/admin/install_tool/', **data)
assert r.json['success'] is False
assert (r.json['info'] ==
- 'Incorrect tool name, or limit is reached.')
+ 'Incorrect tool name, or limit is reached.')
def test_bad_mount(self):
r = self.api_get('/rest/p/test/')
@@ -1192,7 +1192,7 @@ class TestRestInstallTool(TestRestApiBase):
r = self.api_post('/rest/p/test/admin/install_tool/', **data)
assert r.json['success'] is False
assert (r.json['info'] ==
- 'Mount point "tickets_mount1" is invalid')
+ 'Mount point "tickets_mount1" is invalid')
def test_install_tool_ok(self):
r = self.api_get('/rest/p/test/')
@@ -1207,12 +1207,12 @@ class TestRestInstallTool(TestRestApiBase):
r = self.api_post('/rest/p/test/admin/install_tool/', **data)
assert r.json['success'] is True
assert (r.json['info'] ==
- 'Tool %s with mount_point %s and mount_label %s was created.'
- % ('tickets', 'ticketsmount1', 'tickets_label1'))
+ 'Tool %s with mount_point %s and mount_label %s was created.'
+ % ('tickets', 'ticketsmount1', 'tickets_label1'))
project = M.Project.query.get(shortname='test')
assert (project.ordered_mounts()
- [-1]['ac'].options.mount_point == 'ticketsmount1')
+ [-1]['ac'].options.mount_point == 'ticketsmount1')
audit_log = M.AuditLog.query.find(
{'project_id': project._id}).sort('_id', -1).first()
assert audit_log.message == 'install tool ticketsmount1'
@@ -1256,7 +1256,7 @@ class TestRestInstallTool(TestRestApiBase):
r = self.api_post('/rest/p/test/admin/install_tool/', **data)
assert r.json['success'] is False
assert (r.json['info'] ==
- 'Incorrect tool name, or limit is reached.')
+ 'Incorrect tool name, or limit is reached.')
def test_unauthorized(self):
r = self.api_get('/rest/p/test/')
@@ -1285,7 +1285,7 @@ class TestRestInstallTool(TestRestApiBase):
labels.append(mount['sub'].name)
return labels
assert (get_labels() ==
- ['Admin', 'Search', 'Activity', 'A Subproject'])
+ ['Admin', 'Search', 'Activity', 'A Subproject'])
data = [
{
@@ -1316,8 +1316,8 @@ class TestRestInstallTool(TestRestApiBase):
r = self.api_post('/rest/p/test/admin/install_tool/', **datum)
assert r.json['success'] is True
assert (r.json['info'] ==
- 'Tool %s with mount_point %s and mount_label %s was created.'
- % (datum['tool'], datum['mount_point'], datum['mount_label']))
+ 'Tool %s with mount_point %s and mount_label %s was created.'
+ % (datum['tool'], datum['mount_point'], datum['mount_label']))
assert (
get_labels() == ['t1', 'Admin', 'Search', 'Activity', 'A Subproject', 'ta', 'tb', 'tc'])
diff --git a/Allura/allura/tests/functional/test_home.py b/Allura/allura/tests/functional/test_home.py
index 6b62fe97b..0479fc1fb 100644
--- a/Allura/allura/tests/functional/test_home.py
+++ b/Allura/allura/tests/functional/test_home.py
@@ -54,27 +54,27 @@ class TestProjectHome(TestController):
for m in r.json['menu']:
if m['mount_point'] == 'sub1':
assert (m['admin_options'] ==
- [{'className': None,
- 'text': 'Subproject Admin',
- 'href': '/p/test/sub1/admin',
- }])
+ [{'className': None,
+ 'text': 'Subproject Admin',
+ 'href': '/p/test/sub1/admin',
+ }])
break
else:
raise AssertionError('Did not find sub1 subproject in menu results: {}'.format(r.json['menu']))
for m in r.json['menu']:
if m['mount_point'] == 'wiki':
assert {'className': 'admin_modal',
- 'text': 'Set Home',
- 'href': '/p/test/admin/wiki/home',
- } in m['admin_options']
+ 'text': 'Set Home',
+ 'href': '/p/test/admin/wiki/home',
+ } in m['admin_options']
assert {'className': None,
- 'text': 'Permissions',
- 'href': '/p/test/admin/wiki/permissions',
- } in m['admin_options']
+ 'text': 'Permissions',
+ 'href': '/p/test/admin/wiki/permissions',
+ } in m['admin_options']
assert {'className': 'admin_modal',
- 'text': 'Delete Everything',
- 'href': '/p/test/admin/wiki/delete',
- } in m['admin_options']
+ 'text': 'Delete Everything',
+ 'href': '/p/test/admin/wiki/delete',
+ } in m['admin_options']
break
else:
raise AssertionError('Did not find wiki in menu results: {}'.format(r.json['menu']))
@@ -92,12 +92,12 @@ class TestProjectHome(TestController):
wiki_group = menu[-2]
wikis = wiki_group.pop('children')
assert {'url': '/p/test/_list/wiki', 'name': 'Wiki \u25be', 'mount_point': None,
- 'icon': 'tool-wiki', 'tool_name': 'wiki', 'is_anchored': False} == wiki_group
+ 'icon': 'tool-wiki', 'tool_name': 'wiki', 'is_anchored': False} == wiki_group
assert len(wikis) == 2
assert {'url': '/p/test/wiki/', 'name': 'Wiki', 'mount_point': 'wiki',
- 'icon': 'tool-wiki', 'tool_name': 'wiki', 'is_anchored': False} in wikis
+ 'icon': 'tool-wiki', 'tool_name': 'wiki', 'is_anchored': False} in wikis
assert {'url': '/p/test/wiki2/', 'name': 'wiki2', 'mount_point': 'wiki2',
- 'icon': 'tool-wiki', 'tool_name': 'wiki', 'is_anchored': False} in wikis
+ 'icon': 'tool-wiki', 'tool_name': 'wiki', 'is_anchored': False} in wikis
def test_sitemap_limit_per_tool(self):
"""Test that sitemap is limited to max of 10 items per tool type."""
@@ -127,7 +127,7 @@ class TestProjectHome(TestController):
wiki_menu = [m for m in menu if m['tool_name'] == 'wiki'][0]
assert len(wiki_menu['children']) == 10
assert {'url': '/p/test/_list/wiki', 'name': 'More...', 'mount_point': None,
- 'icon': 'tool-wiki', 'tool_name': 'wiki', 'is_anchored': False} in wiki_menu['children']
+ 'icon': 'tool-wiki', 'tool_name': 'wiki', 'is_anchored': False} in wiki_menu['children']
@td.with_wiki
def test_neighborhood_home(self):
diff --git a/Allura/allura/tests/test_globals.py b/Allura/allura/tests/test_globals.py
index 9b16328bc..2ed823368 100644
--- a/Allura/allura/tests/test_globals.py
+++ b/Allura/allura/tests/test_globals.py
@@ -159,8 +159,8 @@ class Test():
ThreadLocalORMSession.flush_all()
with h.push_config(c,
- project=p_nbhd.neighborhood_project,
- user=M.User.by_username('test-admin')):
+ project=p_nbhd.neighborhood_project,
+ user=M.User.by_username('test-admin')):
r = g.markdown_wiki.convert('[[projects]]')
assert 'alt="Test Project Logo"' in r, r
assert 'alt="A Subproject Logo"' in r, r
@@ -243,23 +243,23 @@ class Test():
ThreadLocalORMSession.flush_all()
r = g.markdown_wiki.convert('[[members limit=2]]').replace('\t', '').replace('\n', '')
assert (r ==
- '<div class="markdown_content"><h6>Project Members:</h6>'
- '<ul class="md-users-list">'
- '<li><a href="/u/test-admin/">Test Admin</a> (admin)</li>'
- '<li><a href="/u/test-user/">Test User</a></li>'
- '<li class="md-users-list-more"><a href="/p/test/_members">All Members</a></li>'
- '</ul>'
- '</div>')
+ '<div class="markdown_content"><h6>Project Members:</h6>'
+ '<ul class="md-users-list">'
+ '<li><a href="/u/test-admin/">Test Admin</a> (admin)</li>'
+ '<li><a href="/u/test-user/">Test User</a></li>'
+ '<li class="md-users-list-more"><a href="/p/test/_members">All Members</a></li>'
+ '</ul>'
+ '</div>')
def test_macro_members_escaping(self):
user = M.User.by_username('test-admin')
user.display_name = 'Test Admin <script>'
r = g.markdown_wiki.convert('[[members]]')
assert (r.replace('\n', '').replace('\t', '') ==
- '<div class="markdown_content"><h6>Project Members:</h6>'
- '<ul class="md-users-list">'
- '<li><a href="/u/test-admin/">Test Admin <script></a> (admin)</li>'
- '</ul></div>')
+ '<div class="markdown_content"><h6>Project Members:</h6>'
+ '<ul class="md-users-list">'
+ '<li><a href="/u/test-admin/">Test Admin <script></a> (admin)</li>'
+ '</ul></div>')
def test_macro_project_admins(self):
user = M.User.by_username('test-admin')
@@ -267,10 +267,10 @@ class Test():
with h.push_context('test', neighborhood='Projects'):
r = g.markdown_wiki.convert('[[project_admins]]')
assert (r.replace('\n', '') ==
- '<div class="markdown_content"><h6>Project Admins:</h6>'
- '<ul class="md-users-list">'
- ' <li><a href="/u/test-admin/">Test \xc5dmin <script></a></li>'
- '</ul></div>')
+ '<div class="markdown_content"><h6>Project Admins:</h6>'
+ '<ul class="md-users-list">'
+ ' <li><a href="/u/test-admin/">Test \xc5dmin <script></a></li>'
+ '</ul></div>')
def test_macro_project_admins_one_br(self):
p_nbhd = M.Neighborhood.query.get(name='Projects')
@@ -371,7 +371,7 @@ class Test():
oembed_fetch.side_effect = OEmbedError('Invalid mime-type in response...')
r = g.markdown_wiki.convert('[[embed url=http://www.youtube.com/watch?v=6YbBmqUnoQM]]')
assert (r == '<div class="markdown_content"><p>Could not embed: '
- 'http://www.youtube.com/watch?v=6YbBmqUnoQM</p></div>')
+ 'http://www.youtube.com/watch?v=6YbBmqUnoQM</p></div>')
def test_macro_embed_notsupported(self):
r = g.markdown_wiki.convert('[[embed url=http://vimeo.com/46163090]]')
@@ -447,12 +447,12 @@ class Test():
with h.push_context('test', 'wiki', neighborhood='Projects'):
text = g.markdown.convert('# Foo!\n[Home]')
assert (text ==
- '<div class="markdown_content"><h1 id="foo">Foo!</h1>\n'
- '<p><a class="alink" href="/p/test/wiki/Home/">[Home]</a></p></div>')
+ '<div class="markdown_content"><h1 id="foo">Foo!</h1>\n'
+ '<p><a class="alink" href="/p/test/wiki/Home/">[Home]</a></p></div>')
text = g.markdown.convert('# Foo!\n[Rooted]')
assert (text ==
- '<div class="markdown_content"><h1 id="foo">Foo!</h1>\n'
- '<p><span>[Rooted]</span></p></div>')
+ '<div class="markdown_content"><h1 id="foo">Foo!</h1>\n'
+ '<p><span>[Rooted]</span></p></div>')
assert (
g.markdown.convert('Multi\nLine') ==
@@ -554,7 +554,7 @@ class Test():
g.markdown.convert('literal `http://domain.net` literal'))
assert ('<pre><span></span><code>preformatted http://domain.net\n</code></pre>' in
g.markdown.convert(' :::text\n'
- ' preformatted http://domain.net'))
+ ' preformatted http://domain.net'))
def test_markdown_autolink_with_escape(self):
# \_ is unnecessary but valid markdown escaping and should be considered as a regular underscore
@@ -577,14 +577,14 @@ class Test():
def test_markdown_invalid_script_in_link(self):
r = g.markdown.convert('[xss](http://"><a onmouseover=prompt(document.domain)>xss</a>)')
assert ('<div class="markdown_content"><p><a class="" '
- '''href='http://"><a%20onmouseover=prompt(document.domain)>xss</a>' '''
- 'rel="nofollow">xss</a></p></div>' == r)
+ '''href='http://"><a%20onmouseover=prompt(document.domain)>xss</a>' '''
+ 'rel="nofollow">xss</a></p></div>' == r)
def test_markdown_invalid_script_in_link2(self):
r = g.markdown.convert('[xss](http://"><img src=x onerror=alert(document.cookie)>)')
assert ('<div class="markdown_content"><p><a class="" '
- '''href='http://"><img%20src=x%20onerror=alert(document.cookie)>' '''
- 'rel="nofollow">xss</a></p></div>' == r)
+ '''href='http://"><img%20src=x%20onerror=alert(document.cookie)>' '''
+ 'rel="nofollow">xss</a></p></div>' == r)
def test_markdown_extremely_slow(self):
r = g.markdown.convert('''bonjour, voila ce que j'obtient en voulant ajouter un utilisateur a un groupe de sécurite, que ce soit sur un groupe pre-existant, ou sur un groupe crée.
@@ -686,8 +686,8 @@ class Test():
p_nbhd = M.Neighborhood.query.get(name='Projects')
with h.push_config(c,
- project=p_nbhd.neighborhood_project,
- user=M.User.by_username('test-admin')):
+ project=p_nbhd.neighborhood_project,
+ user=M.User.by_username('test-admin')):
r = g.markdown_wiki.convert(
'[[projects category="%s"]]' % random_trove.fullpath)
project_names = get_project_names(r)
@@ -698,8 +698,8 @@ class Test():
p_nbhd = M.Neighborhood.query.get(name='Projects')
with h.push_config(c,
- project=p_nbhd.neighborhood_project,
- user=M.User.anonymous()):
+ project=p_nbhd.neighborhood_project,
+ user=M.User.anonymous()):
# test columns
r = g.markdown_wiki.convert('[[projects display_mode=list columns=2]]')
assert two_column_style in r
diff --git a/Allura/allura/tests/test_helpers.py b/Allura/allura/tests/test_helpers.py
index 9e2ef3f88..045d9a4e0 100644
--- a/Allura/allura/tests/test_helpers.py
+++ b/Allura/allura/tests/test_helpers.py
@@ -265,17 +265,17 @@ def test_render_any_markup_plain():
def test_render_any_markup_formatting():
assert (str(h.render_any_markup('README.md', '### foo\n'
- ' <script>alert(1)</script> bar')) ==
- '<div class="markdown_content"><h3 id="foo">foo</h3>\n'
- '<div class="codehilite"><pre><span></span><code><span class="nt">'
- '<script></span>alert(1)<span class="nt">'
- '</script></span> bar\n</code></pre></div>\n</div>')
+ ' <script>alert(1)</script> bar')) ==
+ '<div class="markdown_content"><h3 id="foo">foo</h3>\n'
+ '<div class="codehilite"><pre><span></span><code><span class="nt">'
+ '<script></span>alert(1)<span class="nt">'
+ '</script></span> bar\n</code></pre></div>\n</div>')
def test_render_any_markdown_encoding():
# send encoded content in, make sure it converts it to actual unicode object which Markdown lib needs
assert (h.render_any_markup('README.md', 'Müller'.encode()) ==
- '<div class="markdown_content"><p>Müller</p></div>')
+ '<div class="markdown_content"><p>Müller</p></div>')
class AuditLogMock(Mock):
@@ -342,16 +342,16 @@ def test_datetimeformat():
def test_nl2br_jinja_filter():
assert (h.nl2br_jinja_filter('foo<script>alert(1)</script>\nbar\nbaz') ==
- Markup('foo<script>alert(1)</script><br>\nbar<br>\nbaz'))
+ Markup('foo<script>alert(1)</script><br>\nbar<br>\nbaz'))
def test_split_select_field_options():
assert (h.split_select_field_options('"test message" test2') ==
- ['test message', 'test2'])
+ ['test message', 'test2'])
assert (h.split_select_field_options('"test message test2') ==
- ['test', 'message', 'test2'])
+ ['test', 'message', 'test2'])
assert (h.split_select_field_options('abc ƒå∂ ººº') ==
- ['abc', 'ƒå∂', 'ººº'])
+ ['abc', 'ƒå∂', 'ººº'])
def test_notifications_disabled():
@@ -575,9 +575,9 @@ class TestIterEntryPoints(TestCase):
self._make_ep('myapp', BestApp)]
self.assertRaisesRegex(ImportError,
- r'Ambiguous \[allura\] entry points detected. '
- 'Multiple entry points with name "myapp".',
- list, h.iter_entry_points('allura'))
+ r'Ambiguous \[allura\] entry points detected. '
+ 'Multiple entry points with name "myapp".',
+ list, h.iter_entry_points('allura'))
def test_get_user_status():
@@ -596,11 +596,11 @@ def test_get_user_status():
def test_convert_bools():
assert (h.convert_bools({'foo': 'bar', 'baz': 'false', 'abc': 0, 'def': 1, 'ghi': True}) ==
- {'foo': 'bar', 'baz': False, 'abc': 0, 'def': 1, 'ghi': True})
+ {'foo': 'bar', 'baz': False, 'abc': 0, 'def': 1, 'ghi': True})
assert (h.convert_bools({'foo': 'true', 'baz': ' TRUE '}) ==
- {'foo': True, 'baz': True})
+ {'foo': True, 'baz': True})
assert (h.convert_bools({'foo': 'true', 'baz': ' TRUE '}, prefix='ba') ==
- {'foo': 'true', 'baz': True})
+ {'foo': 'true', 'baz': True})
def test_base64uri_img():
@@ -684,6 +684,6 @@ def test_querystring():
req = Request.blank('/p/test/foobar?page=1&limit=10&count=100', remote_addr='127.0.0.1',
base_url='https://mysite.com/p/test/foobar')
assert (h.querystring(req, dict(page=2, limit=5)) ==
- 'https://mysite.com/p/test/foobar/p/test/foobar?page=2&limit=5&count=100')
+ 'https://mysite.com/p/test/foobar/p/test/foobar?page=2&limit=5&count=100')
assert (h.querystring(req, dict(page=5, limit=2, count=None)) ==
- 'https://mysite.com/p/test/foobar/p/test/foobar?page=5&limit=2')
+ 'https://mysite.com/p/test/foobar/p/test/foobar?page=5&limit=2')
diff --git a/Allura/allura/tests/test_plugin.py b/Allura/allura/tests/test_plugin.py
index f1dfaf53e..e440a60d8 100644
--- a/Allura/allura/tests/test_plugin.py
+++ b/Allura/allura/tests/test_plugin.py
@@ -280,7 +280,7 @@ class TestThemeProvider:
app_icon = ThemeProvider().app_icon_url('testapp', 24)
other = app_g.theme_href.return_value
assert app_icon == other
-
+
app_g.theme_href.assert_called_with('images/testapp_24.png')
@patch('allura.lib.plugin.g')
@@ -690,7 +690,7 @@ class TestLocalAuthenticationProvider:
user = M.User(username='asfdasdf')
assert (self.provider.login_details_from_auditlog(M.AuditLog(message='')) ==
- None)
+ None)
detail = self.provider.login_details_from_auditlog(M.AuditLog(message='IP Address: 1.2.3.4\nFoo', user=user))
assert detail.user_id == user._id
@@ -702,16 +702,16 @@ class TestLocalAuthenticationProvider:
assert detail.ua is None
assert (self.provider.login_details_from_auditlog(M.AuditLog(
- message='blah blah IP Address: 1.2.3.4\nFoo', user=user)) ==
- None)
+ message='blah blah IP Address: 1.2.3.4\nFoo', user=user)) ==
+ None)
detail = self.provider.login_details_from_auditlog(M.AuditLog(
- message='User-Agent: Mozilla/Firefox\nFoo', user=user))
+ message='User-Agent: Mozilla/Firefox\nFoo', user=user))
assert detail.ip is None
assert detail.ua == 'Mozilla/Firefox'
detail = self.provider.login_details_from_auditlog(M.AuditLog(
- message='IP Address: 1.2.3.4\nUser-Agent: Mozilla/Firefox\nFoo', user=user))
+ message='IP Address: 1.2.3.4\nUser-Agent: Mozilla/Firefox\nFoo', user=user))
assert detail.ip == '1.2.3.4'
assert detail.ua == 'Mozilla/Firefox'
diff --git a/Allura/allura/tests/test_security.py b/Allura/allura/tests/test_security.py
index 7a27b9302..b99cfe3ba 100644
--- a/Allura/allura/tests/test_security.py
+++ b/Allura/allura/tests/test_security.py
@@ -100,24 +100,24 @@ class TestSecurity(TestController):
assert all_allowed(wiki, dev_role) == {
'read', 'create', 'edit', 'unmoderated_post', 'post', 'moderate', 'delete'}
assert (all_allowed(wiki, member_role) ==
- {'read', 'create', 'edit', 'unmoderated_post', 'post'})
+ {'read', 'create', 'edit', 'unmoderated_post', 'post'})
assert (all_allowed(wiki, auth_role) ==
- {'read', 'post', 'unmoderated_post'})
+ {'read', 'post', 'unmoderated_post'})
assert all_allowed(wiki, anon_role) == {'read'}
assert (all_allowed(wiki, test_user) ==
- {'read', 'post', 'unmoderated_post'})
+ {'read', 'post', 'unmoderated_post'})
_add_to_group(test_user, member_role)
assert (all_allowed(wiki, test_user) ==
- {'read', 'create', 'edit', 'unmoderated_post', 'post'})
+ {'read', 'create', 'edit', 'unmoderated_post', 'post'})
_deny(wiki, auth_role, 'unmoderated_post')
assert (all_allowed(wiki, member_role) ==
- {'read', 'create', 'edit', 'post'})
+ {'read', 'create', 'edit', 'post'})
assert (all_allowed(wiki, test_user) ==
- {'read', 'create', 'edit', 'post'})
+ {'read', 'create', 'edit', 'post'})
@td.with_wiki
def test_deny_vs_allow(self):
@@ -140,7 +140,7 @@ class TestSecurity(TestController):
assert has_access(page, 'post', test_user)()
assert has_access(page, 'unmoderated_post', test_user)()
assert (all_allowed(page, test_user) ==
- {'read', 'post', 'unmoderated_post'})
+ {'read', 'post', 'unmoderated_post'})
_deny(page, auth_role, 'read')
@@ -156,7 +156,7 @@ class TestSecurity(TestController):
assert has_access(wiki, 'post', test_user)()
assert has_access(wiki, 'unmoderated_post', test_user)()
assert (all_allowed(wiki, test_user) ==
- {'read', 'post', 'unmoderated_post'})
+ {'read', 'post', 'unmoderated_post'})
_deny(wiki, anon_role, 'read')
_allow(wiki, auth_role, 'read')
diff --git a/Allura/allura/tests/test_utils.py b/Allura/allura/tests/test_utils.py
index 5165082a3..131e9bf95 100644
--- a/Allura/allura/tests/test_utils.py
+++ b/Allura/allura/tests/test_utils.py
@@ -314,7 +314,7 @@ def test_ip_address():
req.remote_addr = '1.2.3.4'
req.headers = {}
assert (utils.ip_address(req) ==
- '1.2.3.4')
+ '1.2.3.4')
def test_ip_address_header():
@@ -323,7 +323,7 @@ def test_ip_address_header():
req.headers = {'X_FORWARDED_FOR': '5.6.7.8'}
with h.push_config(config, **{'ip_address_header': 'X_FORWARDED_FOR'}):
assert (utils.ip_address(req) ==
- '5.6.7.8')
+ '5.6.7.8')
def test_ip_address_header_not_set():
@@ -332,7 +332,7 @@ def test_ip_address_header_not_set():
req.headers = {}
with h.push_config(config, **{'ip_address_header': 'X_FORWARDED_FOR'}):
assert (utils.ip_address(req) ==
- '1.2.3.4')
+ '1.2.3.4')
def test_empty_cursor():
@@ -384,6 +384,7 @@ class FakeAttachment:
def __init__(self, filename):
self._id = ObjectId()
self.filename = filename
+
def __repr__(self):
return f'{self._id} {self.filename}'
@@ -428,7 +429,7 @@ def test_close_ipv4_addrs():
def test_urlencode():
# dict - a simple one so arbitrary ordering doesn't cause problems on py2
assert (utils.urlencode({'a': 'hello'}) ==
- 'a=hello')
+ 'a=hello')
# list of pairs - including unicode and bytes
assert (utils.urlencode([('a', 1), ('b', 'ƒ'), ('c', 'ƒ'.encode())]) ==
- 'a=1&b=%C6%92&c=%C6%92')
+ 'a=1&b=%C6%92&c=%C6%92')
diff --git a/AlluraTest/alluratest/controller.py b/AlluraTest/alluratest/controller.py
index f110c7a57..885bfbff9 100644
--- a/AlluraTest/alluratest/controller.py
+++ b/AlluraTest/alluratest/controller.py
@@ -108,6 +108,8 @@ def setup_basic_test(config=None, app_name=DFL_APP_NAME):
# remove unnecessary bootstrap tasks, e.g. search indexing
M.MonQTask.query.remove({'state': 'ready'})
+
+
setup_basic_test.__test__ = False # sometimes __test__ above isn't sufficient
@@ -119,6 +121,8 @@ def setup_functional_test(config=None, app_name=DFL_APP_NAME, current_pkg=None):
wsgiapp = loadapp(f'config:{config}#{app_name}',
relative_to=conf_dir)
return wsgiapp
+
+
# sometimes __test__ above isn't sufficient
setup_functional_test.__test__ = False
@@ -145,6 +149,8 @@ def setup_unit_test():
c.model_cache = None
ThreadLocalORMSession.close_all()
+
+
setup_unit_test.__test__ = False # sometimes __test__ above isn't sufficient
@@ -157,8 +163,8 @@ def setup_global_objects():
def setup_trove_categories():
create_trove_categories = CreateTroveCategoriesCommand('create_trove_categories')
with mock.patch.object(M.project.TroveCategoryMapperExtension, 'after_insert'),\
- mock.patch.object(M.project.TroveCategoryMapperExtension, 'after_update'),\
- mock.patch.object(M.project.TroveCategoryMapperExtension, 'after_delete'):
+ mock.patch.object(M.project.TroveCategoryMapperExtension, 'after_update'),\
+ mock.patch.object(M.project.TroveCategoryMapperExtension, 'after_delete'):
create_trove_categories.run([''])
@@ -299,5 +305,5 @@ def oauth1_webtest(url: str, oauth_kwargs: dict, method='GET') -> tuple[str, dic
def request2webtest(req: requests.PreparedRequest) -> tuple[str, dict, dict]:
url = req.url
params = {}
- headers = {k: v.decode() for k,v in req.headers.items()}
+ headers = {k: v.decode() for k, v in req.headers.items()}
return url, params, headers
diff --git a/ForgeActivity/forgeactivity/tests/functional/test_root.py b/ForgeActivity/forgeactivity/tests/functional/test_root.py
index 5860ac7e2..41d5256f6 100644
--- a/ForgeActivity/forgeactivity/tests/functional/test_root.py
+++ b/ForgeActivity/forgeactivity/tests/functional/test_root.py
@@ -53,7 +53,7 @@ class TestActivityController(TestController):
@td.with_user_project('test-user-1')
def test_anon_read(self):
r = self.app.get('/u/test-user-1',
- extra_environ={'username': '*anonymous'}).follow()
+ extra_environ={'username': '*anonymous'}).follow()
assert r.html.select('div.profile-section.tools a[href="/u/test-user-1/activity/"]'),\
'No Activity tool in top nav'
@@ -215,15 +215,15 @@ class TestActivityController(TestController):
assert 1 == len(timeline.findall('item'))
activity = timeline.find('item')
assert (activity.find('pubDate').text ==
- 'Wed, 04 Dec 2013 21:48:19 -0000')
+ 'Wed, 04 Dec 2013 21:48:19 -0000')
assert (activity.find('title').text ==
- 'Administrator 1 posted a comment on ticket #34')
+ 'Administrator 1 posted a comment on ticket #34')
assert (activity.find('description').text ==
- 'Just wanted to leave a comment on this...')
+ 'Just wanted to leave a comment on this...')
assert (activity.find('guid').text ==
- 'http://localhost/p/test/unicode•º/?limit=25#ed7c')
+ 'http://localhost/p/test/unicode•º/?limit=25#ed7c')
assert (activity.find('link').text ==
- 'http://localhost/p/test/unicode%E2%80%A2%C2%BA/?limit=25#ed7c')
+ 'http://localhost/p/test/unicode%E2%80%A2%C2%BA/?limit=25#ed7c')
@td.with_tool('test', 'activity')
@patch('forgeactivity.main.g.director')
@@ -289,13 +289,13 @@ class TestActivityController(TestController):
assert 1 == len(timeline.findall('item'))
activity = timeline.find('item')
assert (activity.find('pubDate').text ==
- 'Wed, 04 Dec 2013 21:48:19 -0000')
+ 'Wed, 04 Dec 2013 21:48:19 -0000')
assert (activity.find('title').text ==
- 'Administrator 1 posted a comment on ticket #34')
+ 'Administrator 1 posted a comment on ticket #34')
assert (activity.find('description').text ==
- 'Just wanted to leave a comment on this...')
+ 'Just wanted to leave a comment on this...')
assert (activity.find('link').text ==
- 'http://localhost/p/test/tickets/34/?limit=25#ed7c')
+ 'http://localhost/p/test/tickets/34/?limit=25#ed7c')
@td.with_tool('test', 'activity')
@patch('forgeactivity.main.g.director')
diff --git a/ForgeGit/forgegit/tests/functional/test_controllers.py b/ForgeGit/forgegit/tests/functional/test_controllers.py
index 2d6b333df..d42d91239 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -231,7 +231,7 @@ class TestRootController(_TestCase):
assert title == 'test Git changes'
description = channel.find('description').text
assert (description ==
- 'Recent changes to Git repository in test project')
+ 'Recent changes to Git repository in test project')
link = channel.find('link').text
assert link == 'http://localhost/p/test/src-git/'
earliest_commit = channel.findall('item')[-1]
@@ -288,25 +288,25 @@ class TestRootController(_TestCase):
resp = self.app.get(url)
assert 'Привіт!\nWhich means Hello!' in resp.text
assert (six.ensure_text(resp.headers.get('Content-Disposition')) ==
- 'attachment;filename="%D0%BF%D1%80%D0%B8%D0%B2%D1%96%D1%82.txt"')
+ 'attachment;filename="%D0%BF%D1%80%D0%B8%D0%B2%D1%96%D1%82.txt"')
url = ci + 'tree/' + h.urlquote('with space.txt') + '?format=raw'
resp = self.app.get(url)
assert 'with space' in resp.text
assert (six.ensure_text(resp.headers.get('Content-Disposition')) ==
- 'attachment;filename="with%20space.txt"')
+ 'attachment;filename="with%20space.txt"')
url = ci + 'tree/' + h.urlquote('with%2Furlquote-literal.txt') + '?format=raw'
resp = self.app.get(url)
assert '%2F means /' in resp.body.decode('utf-8')
assert (resp.headers.get('Content-Disposition') ==
- 'attachment;filename="with%252Furlquote-literal.txt"')
+ 'attachment;filename="with%252Furlquote-literal.txt"')
url = ci + 'tree/' + h.urlquote('with"&:specials.txt') + '?format=raw'
resp = self.app.get(url)
assert '"&: encodes as %22%26%3A' in resp.body.decode('utf-8')
assert (resp.headers.get('Content-Disposition') ==
- 'attachment;filename="with%22%26%3Aspecials.txt"')
+ 'attachment;filename="with%22%26%3Aspecials.txt"')
def test_file_too_large(self):
ci = self._get_ci()
@@ -340,7 +340,7 @@ class TestRootController(_TestCase):
<span class="gu">@@ -1 +1,2 @@</span><span class="w"></span>
<span class="w"> </span>Привіт!<span class="w"></span>
<span class="gi">+Which means Hello!</span><span class="w"></span>''') in
- diffhtml)
+ diffhtml)
resp = self.app.get(h.urlquote(ci + 'tree/привіт.txt') + '?diff=407950e8fba4dbc108ffbce0128ed1085c52cfd7&diformat=sidebyside')
diffhtml = str(resp.html.select_one('.diffbrowser'))
@@ -366,7 +366,7 @@ class TestRootController(_TestCase):
<td class="lineno">2</td>
<td class="diff-add"><pre>Which means Hello!
</pre></td>''') in
- diffhtml)
+ diffhtml)
def test_diff_view_mode(self):
ci = self._get_ci()
@@ -533,7 +533,7 @@ class TestRootController(_TestCase):
r.form['merge_disabled'].checked = True
r = r.form.submit()
assert (json.loads(self.webflash(r))['message'] ==
- "External checkout URL successfully changed. One-click merge disabled.")
+ "External checkout URL successfully changed. One-click merge disabled.")
# for some reason c.app.config.options has old values still
app_config = M.AppConfig.query.get(_id=c.app.config._id)
assert app_config.options['external_checkout_url'] == 'http://foo.bar/baz'
@@ -752,7 +752,7 @@ class TestFork(_TestCase):
assert rev_links[0].get('href') == '/p/test2/code/ci/%s/' % c_id
assert rev_links[0].getText() == '[%s]' % c_id[:6]
assert (browse_links[0].get('href') ==
- '/p/test2/code/ci/%s/tree' % c_id)
+ '/p/test2/code/ci/%s/tree' % c_id)
assert browse_links[0].getText().strip() == 'Tree'
r = self.app.get('/p/test/src-git/merge-requests/1/commits_html', status=200)
@@ -807,7 +807,7 @@ class TestFork(_TestCase):
assert 'Merge Request #%s: (rejected)' % mr_num in r, r
def test_merge_request_default_branches(self):
- _select_val = lambda r, n: r.html.find('select', {'name': n}).find(selected=True).string
+ def _select_val(r, n): return r.html.find('select', {'name': n}).find(selected=True).string
r = self.app.get('/p/test2/code/request_merge')
assert _select_val(r, 'source_branch') == 'master'
assert _select_val(r, 'target_branch') == 'master'
@@ -1041,8 +1041,8 @@ class TestGitRename(TestController):
# the diff portion of the output
resp_no_ws = re.sub(r'\s+', '', str(resp))
assert ('<a href="/p/test/src-git/ci/fbb0644603bb6ecee3ebb62efe8c86efc9b84ee6/tree/f.txt" rel="nofollow">f.txt</a>'
- 'to<a href="/p/test/src-git/ci/b120505a61225e6c14bee3e5b5862db81628c35c/tree/f2.txt" rel="nofollow">f2.txt</a>'
- .replace(' ', '') in resp_no_ws)
+ 'to<a href="/p/test/src-git/ci/b120505a61225e6c14bee3e5b5862db81628c35c/tree/f2.txt" rel="nofollow">f2.txt</a>'
+ .replace(' ', '') in resp_no_ws)
assert '<span class="empty-diff">File was renamed.</span>' in resp
def test_directory_changed_type(self):
@@ -1051,10 +1051,10 @@ class TestGitRename(TestController):
resp_no_ws = re.sub(r'\s+', '', str(resp))
assert ('<a href="/p/test/src-git/ci/7b1c9ef214eb0ef8c06bada0966dd941f442beec/tree/b_dir" rel="nofollow">b_dir</a>'
- '</h6>'
- '<div id="diff-3" class="inline-diff-body">'
- '<span class="empty-diff">Symlink.</span>'
- .replace(' ', '') in resp_no_ws)
+ '</h6>'
+ '<div id="diff-3" class="inline-diff-body">'
+ '<span class="empty-diff">Symlink.</span>'
+ .replace(' ', '') in resp_no_ws)
def test_symlink_in_tree(self):
# change a_dir to a file; b_dir to a symlink
@@ -1152,9 +1152,9 @@ class TestIncludeMacro(_TestCase):
def test_include_file_cant_find_file(self):
expected = "[[include can't find file %s in revision %s]]"
assert (macro.include_file('src-git', 'a.txt') ==
- expected % ('a.txt', '1e146e67985dcd71c74de79613719bef7bddca4a'))
+ expected % ('a.txt', '1e146e67985dcd71c74de79613719bef7bddca4a'))
assert (macro.include_file('src-git', 'a.txt', '6a45885ae7347f1cac5103b0050cc1be6a1496c8') ==
- expected % ('a.txt', '6a45885ae7347f1cac5103b0050cc1be6a1496c8'))
+ expected % ('a.txt', '6a45885ae7347f1cac5103b0050cc1be6a1496c8'))
@patch('allura.model.repo.Blob.has_pypeline_view', new_callable=PropertyMock)
@patch('allura.model.repo.Blob.has_html_view', new_callable=PropertyMock)
diff --git a/ForgeImporters/forgeimporters/github/tests/test_wiki.py b/ForgeImporters/forgeimporters/github/tests/test_wiki.py
index 3b7a7a05d..3d83b5742 100644
--- a/ForgeImporters/forgeimporters/github/tests/test_wiki.py
+++ b/ForgeImporters/forgeimporters/github/tests/test_wiki.py
@@ -49,8 +49,8 @@ class TestGitHubWikiImporter(TestCase):
@patch('forgeimporters.github.wiki.GitHubProjectExtractor')
def test_import_tool_happy_path(self, ghpe, g, tlorms, M):
with patch('forgeimporters.github.wiki.GitHubWikiImporter.import_pages'),\
- patch('forgeimporters.github.wiki.GitHubWikiImporter.has_wiki_repo', return_value=True),\
- patch('forgeimporters.github.wiki.c'):
+ patch('forgeimporters.github.wiki.GitHubWikiImporter.has_wiki_repo', return_value=True),\
+ patch('forgeimporters.github.wiki.c'):
ghpe.return_value.has_wiki.return_value = True
p = self._make_project(gh_proj_name='myproject')
u = Mock(name='c.user')
@@ -179,7 +179,7 @@ class TestGitHubWikiImporter(TestCase):
importer._with_history(self.commit2)
assert upsert.call_args_list == [call('Home')]
assert (render.call_args_list ==
- [call('Home.rst', '# test message')])
+ [call('Home.rst', '# test message')])
@skipIf(module_not_available('html2text'), 'html2text required')
@patch('forgeimporters.github.wiki.WM.Page.upsert')
@@ -237,9 +237,9 @@ class TestGitHubWikiImporter(TestCase):
assert f('[[Page-With-Spaces]]') == '[Page With Spaces]'
assert f('[[Page / 1]]') == '[Page 1]'
assert (f('[[Title|Page With Spaces]]') ==
- '[Title](Page With Spaces)')
+ '[Title](Page With Spaces)')
assert (f('[[Title|Page-With-Spaces]]') ==
- '[Title](Page With Spaces)')
+ '[Title](Page With Spaces)')
assert f('[[go here|Page / 1]]') == '[go here](Page 1)'
def test_convert_gollum_page_links_escaped(self):
@@ -250,9 +250,9 @@ class TestGitHubWikiImporter(TestCase):
assert f("'[[Page-With-Spaces]]") == '[[Page-With-Spaces]]'
assert f("'[[Page / 1]]") == '[[Page / 1]]'
assert (f("'[[Title|Page With Spaces]]") ==
- '[[Title|Page With Spaces]]')
+ '[[Title|Page With Spaces]]')
assert (f("'[[Title|Page-With-Spaces]]") ==
- '[[Title|Page-With-Spaces]]')
+ '[[Title|Page-With-Spaces]]')
assert f("'[[go here|Page / 1]]") == '[[go here|Page / 1]]'
def test_convert_gollum_external_links(self):
@@ -260,14 +260,14 @@ class TestGitHubWikiImporter(TestCase):
assert f('[[http://domain.net]]') == '<http://domain.net>'
assert f('[[https://domain.net]]') == '<https://domain.net>'
assert (f('[[Site|http://domain.net]]') ==
- '[Site](http://domain.net)')
+ '[Site](http://domain.net)')
def test_convert_gollum_external_links_escaped(self):
f = GitHubWikiImporter().convert_gollum_tags
assert f("'[[http://domain.net]]") == '[[http://domain.net]]'
assert f("'[[https://domain.net]]") == '[[https://domain.net]]'
assert (f("'[[Site|http://domain.net]]") ==
- '[[Site|http://domain.net]]')
+ '[[Site|http://domain.net]]')
def test_convert_gollum_toc(self):
f = GitHubWikiImporter().convert_gollum_tags
@@ -516,7 +516,7 @@ some text and **[Tips n\u2019 Tricks]**
f = importer.convert_markup
source = '*[[this checklist|Troubleshooting]]*'
assert (f(source, 't.textile').strip() ==
- '**[this checklist](Troubleshooting)**')
+ '**[this checklist](Troubleshooting)**')
@without_module('html2text')
def test_convert_textile_special_tag_without_html2text(self):
diff --git a/ForgeSVN/forgesvn/tests/functional/test_controllers.py b/ForgeSVN/forgesvn/tests/functional/test_controllers.py
index a337014c6..6b0bea243 100644
--- a/ForgeSVN/forgesvn/tests/functional/test_controllers.py
+++ b/ForgeSVN/forgesvn/tests/functional/test_controllers.py
@@ -115,7 +115,7 @@ class TestRootController(SVNTestController):
assert title == 'test SVN changes'
description = channel.find('description').text
assert (description ==
- 'Recent changes to SVN repository in test project')
+ 'Recent changes to SVN repository in test project')
link = channel.find('link').text
assert link == 'http://localhost/p/test/src/'
earliest_commit = channel.findall('item')[-1]
@@ -144,7 +144,7 @@ class TestRootController(SVNTestController):
file_url = resp.html.find("a", string="/ЗРЯЧИЙ_ТА_ПОБАЧИТЬ")['href']
resp = self.app.get(file_url)
assert ('This is readme' in # same content as the README file actually
- resp.html.select_one('.codebrowser').text)
+ resp.html.select_one('.codebrowser').text)
resp = self.app.get('/src/7/')
print('file links on /src/7/ are:\n\t{}'.format(
@@ -152,22 +152,22 @@ class TestRootController(SVNTestController):
file_url = resp.html.find("a", string="/with%2Furlquote-literal.txt")['href']
file_resp = self.app.get(file_url)
assert ('%2F means /' in
- file_resp.html.select_one('.codebrowser').text)
+ file_resp.html.select_one('.codebrowser').text)
file_url = resp.html.find("a", string='/with-percent%.txt')['href']
file_resp = self.app.get(file_url)
assert ('%%%' in
- file_resp.html.select_one('.codebrowser').text)
+ file_resp.html.select_one('.codebrowser').text)
file_url = resp.html.find("a", string="/with space.txt")['href']
file_resp = self.app.get(file_url)
assert ('spaces' in
- file_resp.html.select_one('.codebrowser').text)
+ file_resp.html.select_one('.codebrowser').text)
file_url = resp.html.find("a", string='/with"&:specials.txt')['href']
file_resp = self.app.get(file_url)
assert ('"&: encodes as %22%26%3A' in
- file_resp.html.select_one('.codebrowser').text)
+ file_resp.html.select_one('.codebrowser').text)
def test_tree(self):
resp = self.app.get('/src/1/tree/')
@@ -324,7 +324,7 @@ class TestImportController(SVNTestController):
r = self.app.post('/p/test/admin/empty/importer/do_import',
{'checkout_url': 'http://10.0.0.0/trac/url'})
assert 'Invalid URL' in r
-
+
r = self.app.post('/p/test/admin/empty/importer/do_import',
{'checkout_url': 'http://fake.svn/'})
assert 'That is not a valid URL' not in r
diff --git a/ForgeSVN/forgesvn/tests/model/test_repository.py b/ForgeSVN/forgesvn/tests/model/test_repository.py
index fcd1f6656..4716bff9f 100644
--- a/ForgeSVN/forgesvn/tests/model/test_repository.py
+++ b/ForgeSVN/forgesvn/tests/model/test_repository.py
@@ -237,7 +237,7 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
def test_log(self):
entries = list(self.repo.log(id_only=False, limit=25))
assert (entries[len(entries)-6:] == # only 6, so this test doesn't have to change when commits added
- [
+ [
{'parents': [5],
'refs': [],
'committed': {
@@ -250,7 +250,7 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
'date': datetime(2013, 11, 8, 13, 38, 11, 152821),
'name': 'coldmind',
'email': ''
- }, 'size': None},
+ }, 'size': None},
{'parents': [4],
'refs': [],
'committed': {
@@ -405,8 +405,8 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
def test_diff_copy(self):
entry = self.repo.commit(next(self.repo.log(5, id_only=True, limit=1)))
assert dict(entry.diffs) == dict(
- copied=[{'new': '/b', 'old': '/a', 'ratio': 1}], renamed=[],
- changed=[], removed=[], added=[], total=1)
+ copied=[{'new': '/b', 'old': '/a', 'ratio': 1}], renamed=[],
+ changed=[], removed=[], added=[], total=1)
def test_commit(self):
entry = self.repo.commit(1)
@@ -430,16 +430,16 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
def test_tarball(self):
tmpdir = tg.config['scm.repos.tarball.root']
assert (self.repo.tarball_path ==
- os.path.join(tmpdir, 'svn/t/te/test/testsvn'))
+ os.path.join(tmpdir, 'svn/t/te/test/testsvn'))
assert (self.repo.tarball_url('1') ==
- 'file:///svn/t/te/test/testsvn/test-src-r1.zip')
+ 'file:///svn/t/te/test/testsvn/test-src-r1.zip')
self.repo.tarball('1')
assert os.path.isfile(
os.path.join(tmpdir, "svn/t/te/test/testsvn/test-src-r1.zip"))
tarball_zip = ZipFile(
os.path.join(tmpdir, 'svn/t/te/test/testsvn/test-src-r1.zip'), 'r')
assert (tarball_zip.namelist() ==
- ['test-src-r1/', 'test-src-r1/README'])
+ ['test-src-r1/', 'test-src-r1/README'])
shutil.rmtree(self.repo.tarball_path.encode('utf-8'),
ignore_errors=True)
@@ -768,12 +768,12 @@ class TestRepo(_TestWithRepo):
def test_scm_host_url(self):
assert (self.repo.clone_url('rw', 'nobody') ==
- 'svn+ssh://nobody@localhost:8022/scm-repo/p/test/test1/')
+ 'svn+ssh://nobody@localhost:8022/scm-repo/p/test/test1/')
assert (self.repo.clone_url('https', 'nobody') ==
- 'https://nobody@localhost:8022/scm-repo/p/test/test1/')
+ 'https://nobody@localhost:8022/scm-repo/p/test/test1/')
with h.push_config(self.repo.app.config.options, external_checkout_url='https://$username@foo.com/'):
assert (self.repo.clone_url('https', 'user') ==
- 'https://user@foo.com/')
+ 'https://user@foo.com/')
def test_guess_type(self):
assert self.repo.guess_type('foo.txt') == ('text/plain', None)
@@ -810,7 +810,7 @@ class TestRepo(_TestWithRepo):
email=committer_email),
_id=oid)).m.insert()
self.repo._impl.refresh_commit_info = refresh_commit_info
- _id = lambda oid: getattr(oid, '_id', str(oid))
+ def _id(oid): return getattr(oid, '_id', str(oid))
self.repo.shorthand_for_commit = lambda oid: '[' + _id(oid) + ']'
self.repo.url_for_commit = lambda oid: '/ci/' + _id(oid) + '/'
self.repo.refresh()
@@ -943,7 +943,7 @@ class TestCommit(_TestWithRepo):
'total': 5,
}
assert (self.ci.diffs.added ==
- ['a', 'a/a', 'a/a/a', 'a/a/b', 'a/b'])
+ ['a', 'a/a', 'a/a/a', 'a/a/b', 'a/b'])
assert (self.ci.diffs.copied
== self.ci.diffs.changed
== self.ci.diffs.removed
@@ -1050,7 +1050,7 @@ class TestRename(unittest.TestCase):
result = self.repo._impl._check_changed_path(
changed_path, '/test/path2/file.txt')
assert {'path': '/test/path2/file.txt',
- 'copyfrom_path': '/test/path/file.txt'} == result
+ 'copyfrom_path': '/test/path/file.txt'} == result
class TestDirectRepoAccess:
diff --git a/ForgeTracker/forgetracker/model/ticket.py b/ForgeTracker/forgetracker/model/ticket.py
index 34aa72e94..562a30fd0 100644
--- a/ForgeTracker/forgetracker/model/ticket.py
+++ b/ForgeTracker/forgetracker/model/ticket.py
@@ -301,16 +301,16 @@ class Globals(MappedClass):
fromaddr=str(c.user.email_address_header()),
reply_to=str(c.user.email_address_header()),
subject='[{}:{}] Mass ticket moving by {}'.format(c.project.shortname,
- self.app_config.options.mount_point,
- c.user.display_name))
+ self.app_config.options.mount_point,
+ c.user.display_name))
tmpl = g.jinja2_env.get_template(
'forgetracker:data/mass_move_report.html')
tmpl_context = {
'original_tracker': '{}:{}'.format(c.project.shortname,
- self.app_config.options.mount_point),
+ self.app_config.options.mount_point),
'destination_tracker': '{}:{}'.format(tracker.project.shortname,
- tracker.options.mount_point),
+ tracker.options.mount_point),
'tickets': [],
}
for user in users:
@@ -345,9 +345,9 @@ class Globals(MappedClass):
mail_tasks.sendmail.post(**mail)
moved_from = '{}/{}'.format(c.project.shortname,
- self.app_config.options.mount_point)
+ self.app_config.options.mount_point)
moved_to = '{}/{}'.format(tracker.project.shortname,
- tracker.options.mount_point)
+ tracker.options.mount_point)
text = f'Tickets moved from {moved_from} to {moved_to}'
Notification.post_user(c.user, None, 'flash', text=text)
@@ -466,8 +466,8 @@ class Globals(MappedClass):
fromaddr=str(c.user._id),
reply_to=tg_config['forgemail.return_path'],
subject='[{}:{}] Mass edit changes by {}'.format(c.project.shortname,
- self.app_config.options.mount_point,
- c.user.display_name),
+ self.app_config.options.mount_point,
+ c.user.display_name),
)
tmpl = g.jinja2_env.get_template('forgetracker:data/mass_report.html')
head = []
@@ -514,7 +514,7 @@ class Globals(MappedClass):
self.invalidate_bin_counts()
ThreadLocalORMSession.flush_all()
app = '{}/{}'.format(c.project.shortname,
- self.app_config.options.mount_point)
+ self.app_config.options.mount_point)
count = len(tickets)
text = 'Updated {} ticket{} in {}'.format(
count, 's' if count != 1 else '', app)
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index 5c082033e..54a631f96 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -360,8 +360,8 @@ class TestFunctionalController(TrackerTestController):
r = self.app.get('/bugs/bin_counts')
assert r.json == {"bin_counts": [{"count": 2, "label": "Changes"},
- {"count": 0, "label": "Closed Tickets"},
- {"count": 2, "label": "Open Tickets"}]}
+ {"count": 0, "label": "Closed Tickets"},
+ {"count": 2, "label": "Open Tickets"}]}
"""
forgetracker.model.ticket.Globals.bin_count doesn't do a permission check like corresponding milestone_count
@@ -1982,7 +1982,7 @@ class TestFunctionalController(TrackerTestController):
filtered_changes = c.app.globals.filtered_by_subscription(changes)
filtered_users = [uid for uid, data in filtered_changes.items()]
assert (sorted(filtered_users) ==
- sorted(u._id for u in users[:-1] + [admin]))
+ sorted(u._id for u in users[:-1] + [admin]))
ticket_ids = [t._id for t in tickets]
assert filtered_changes[users[0]._id] == set(ticket_ids[0:1])
assert filtered_changes[users[1]._id] == set(ticket_ids[:-1])
@@ -2484,12 +2484,12 @@ class TestFunctionalController(TrackerTestController):
r = self.app.get('/rest/p/test/bugs/1/')
r = json.loads(r.text)
assert (r['ticket']['discussion_thread_url'] ==
- 'http://localhost/rest%s' % discussion_url)
+ 'http://localhost/rest%s' % discussion_url)
slug = r['ticket']['discussion_thread']['posts'][0]['slug']
assert (r['ticket']['discussion_thread']['posts'][0]['attachments'][0]['url'] ==
- f'http://localhost{discussion_url}{slug}/attachment/test.txt')
+ f'http://localhost{discussion_url}{slug}/attachment/test.txt')
assert (r['ticket']['discussion_thread']['posts'][0]['attachments'][0]['bytes'] ==
- 11)
+ 11)
file_name = 'test_root.py'
file_data = open(__file__, 'rb').read()
@@ -2500,7 +2500,7 @@ class TestFunctionalController(TrackerTestController):
r = self.app.get('/rest/p/test/bugs/1/')
r = json.loads(r.text)
assert (r['ticket']['attachments'][0]['url'] ==
- 'http://localhost/p/test/bugs/1/attachment/test_root.py')
+ 'http://localhost/p/test/bugs/1/attachment/test_root.py')
def test_html_escaping(self):
with mock.patch.object(mail_tasks.smtp_client, '_client') as _client:
@@ -2512,7 +2512,7 @@ class TestFunctionalController(TrackerTestController):
email = M.MonQTask.query.find(
dict(task_name='allura.tasks.mail_tasks.sendmail')).first()
assert (email.kwargs.subject ==
- '[test:bugs] #1 test <h2> ticket')
+ '[test:bugs] #1 test <h2> ticket')
text = email.kwargs.text
assert '** [bugs:#1] test <h2> ticket**' in text
mail_tasks.sendmail(
@@ -2529,8 +2529,8 @@ class TestFunctionalController(TrackerTestController):
assert 'Subject: [test:bugs] #1 test <h2> ticket' in body
# check html, need tags escaped
assert ('<p><strong> <a class="alink" href="http://localhost/p/test/bugs/1/">[bugs:#1]</a>'
- ' test <h2> ticket</strong></p>' in
- body)
+ ' test <h2> ticket</strong></p>' in
+ body)
# check plaintext (ok to have "html" tags)
assert '** [bugs:#1] test <h2> ticket**' in body
@@ -2896,7 +2896,7 @@ class TestCustomUserField(TrackerTestController):
ticket_view = self.new_ticket(summary='test custom fields', **kw).follow()
# summary header shows 'nobody'
assert (squish_spaces(ticket_view.html.findAll('label', 'simple', text='Code Review:')[0].parent.text) ==
- ' Code Review: nobody ')
+ ' Code Review: nobody ')
# form input is blank
select = ticket_view.html.find('select',
dict(name='ticket_form.custom_fields._code_review'))
@@ -2911,7 +2911,7 @@ class TestCustomUserField(TrackerTestController):
ticket_view = self.new_ticket(summary='test custom fields', **kw).follow()
# summary header shows 'Test Admin'
assert (squish_spaces(ticket_view.html.findAll('label', 'simple', text='Code Review:')[0].parent.text) ==
- ' Code Review: Test Admin ')
+ ' Code Review: Test Admin ')
# form input is blank
select = ticket_view.html.find('select',
dict(name='ticket_form.custom_fields._code_review'))
@@ -3106,7 +3106,7 @@ class TestBulkMove(TrackerTestController):
assert len(emails) == 3
for email in emails:
assert (email.kwargs.subject ==
- '[test:bugs] Mass ticket moving by Test Admin')
+ '[test:bugs] Mass ticket moving by Test Admin')
first_user_email = M.MonQTask.query.find({
'task_name': 'allura.tasks.mail_tasks.sendmail',
'kwargs.destinations': str(first_user._id)
@@ -3143,7 +3143,7 @@ class TestBulkMove(TrackerTestController):
notification_id = mbox.queue[-1]
notification = M.Notification.query.get(_id=notification_id)
assert (notification.text ==
- 'Tickets moved from test/bugs to test2/bugs2')
+ 'Tickets moved from test/bugs to test2/bugs2')
@td.with_tool('test2', 'Tickets', 'bugs2')
def test_monitoring_email(self):
@@ -3169,7 +3169,7 @@ class TestBulkMove(TrackerTestController):
assert len(emails) == 2
for email in emails:
assert (email.kwargs.subject ==
- '[test:bugs] Mass ticket moving by Test Admin')
+ '[test:bugs] Mass ticket moving by Test Admin')
admin_email = M.MonQTask.query.find({
'task_name': 'allura.tasks.mail_tasks.sendmail',
'kwargs.destinations': str(M.User.by_username('test-admin')._id)
@@ -3182,18 +3182,18 @@ class TestBulkMove(TrackerTestController):
assert len(monitoring_email) == 1
admin_email_text = admin_email[0].kwargs.text
assert ('test:bugs:#1 --> test2:bugs2:#1 A New Hope' in
- admin_email_text)
+ admin_email_text)
assert ('test:bugs:#2 --> test2:bugs2:#2 The Empire Strikes Back' in
- admin_email_text)
+ admin_email_text)
assert ('test:bugs:#3 --> test2:bugs2:#3 Return Of The Jedi' in
- admin_email_text)
+ admin_email_text)
monitoring_email_text = monitoring_email[0].kwargs.text
assert ('test:bugs:#1 --> test2:bugs2:#1 A New Hope' in
- monitoring_email_text)
+ monitoring_email_text)
assert ('test:bugs:#2 --> test2:bugs2:#2 The Empire Strikes Back' in
- monitoring_email_text)
+ monitoring_email_text)
assert ('test:bugs:#3 --> test2:bugs2:#3 Return Of The Jedi' in
- monitoring_email_text)
+ monitoring_email_text)
@td.with_tool('test2', 'Tickets', 'bugs2')
def test_monitoring_email_public_only(self):
@@ -3226,7 +3226,7 @@ class TestBulkMove(TrackerTestController):
assert len(emails) == 2
for email in emails:
assert (email.kwargs.subject ==
- '[test:bugs] Mass ticket moving by Test Admin')
+ '[test:bugs] Mass ticket moving by Test Admin')
admin = M.User.by_username('test-admin')
admin_email = M.MonQTask.query.find({
'task_name': 'allura.tasks.mail_tasks.sendmail',
@@ -3273,7 +3273,7 @@ class TestBulkMove(TrackerTestController):
assert len(emails) == 1 # only admin email sent
for email in emails:
assert (email.kwargs.subject ==
- '[test:bugs] Mass ticket moving by Test Admin')
+ '[test:bugs] Mass ticket moving by Test Admin')
admin = M.User.by_username('test-admin')
admin_email = M.MonQTask.query.find({
'task_name': 'allura.tasks.mail_tasks.sendmail',
@@ -3350,7 +3350,7 @@ class TestNotificationEmailGrouping(TrackerTestController):
assert email.kwargs.message_id == ticket.url() + reply._id
assert email.kwargs.in_reply_to == top_level_comment_msg_id
assert (email.kwargs.references ==
- [ticket.message_id(), top_level_comment_msg_id])
+ [ticket.message_id(), top_level_comment_msg_id])
def test_status_passthru():
diff --git a/scripts/migrations/034-update_subscriptions_ticket_and_mr_titles.py b/scripts/migrations/034-update_subscriptions_ticket_and_mr_titles.py
index 94904c814..cb82382b8 100644
--- a/scripts/migrations/034-update_subscriptions_ticket_and_mr_titles.py
+++ b/scripts/migrations/034-update_subscriptions_ticket_and_mr_titles.py
@@ -42,7 +42,7 @@ def main():
if not sub.artifact_index_id:
log.info('No artifact_index_id on %s', sub)
continue
- ticket = TM.Ticket.query.get(_id = ObjectId(sub.artifact_index_id.split('#')[1]))
+ ticket = TM.Ticket.query.get(_id=ObjectId(sub.artifact_index_id.split('#')[1]))
if not ticket:
log.info('Could not find ticket for %s', sub)
continue
@@ -60,12 +60,12 @@ def main():
if not sub.artifact_index_id:
log.info('No artifact_index_id on %s', sub)
continue
- merge_request = M.MergeRequest.query.get(_id = ObjectId(sub.artifact_index_id.split('#')[1]))
+ merge_request = M.MergeRequest.query.get(_id=ObjectId(sub.artifact_index_id.split('#')[1]))
if not merge_request:
log.info('Could not find merge request for %s', sub)
continue
new_title = 'Merge Request #%d: %s' % (merge_request.request_number, merge_request.summary)
- log.info('"%s" --> "%s"', sub.artifact_title , new_title)
+ log.info('"%s" --> "%s"', sub.artifact_title, new_title)
if task != 'diff':
sub.artifact_title = new_title
session(sub).flush(sub)