mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2026-02-10 17:16:22 +01:00
remove trailing whitespaces
This commit is contained in:
@@ -17,7 +17,7 @@ class SrpMenu(MenuItemHook):
|
||||
def render(self, request):
|
||||
if request.user.has_perm('srp.access_srp'):
|
||||
app_count = SRPManager.pending_requests_count_for_user(request.user)
|
||||
self.count = app_count if app_count and app_count > 0 else None
|
||||
self.count = app_count if app_count and app_count > 0 else None
|
||||
return MenuItemHook.render(self, request)
|
||||
return ''
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class SRPManager:
|
||||
|
||||
|
||||
@staticmethod
|
||||
def get_kill_id(killboard_link):
|
||||
num_set = '0123456789'
|
||||
@@ -55,7 +55,7 @@ class SRPManager:
|
||||
|
||||
@staticmethod
|
||||
def pending_requests_count_for_user(user: User):
|
||||
"""returns the number of open SRP requests for given user
|
||||
"""returns the number of open SRP requests for given user
|
||||
or None if user has no permission"""
|
||||
if user.has_perm("auth.srp_management"):
|
||||
return SrpUserRequest.objects.filter(srp_status="pending").count()
|
||||
|
||||
@@ -19,7 +19,7 @@ currentdir = os.path.dirname(os.path.abspath(inspect.getfile(
|
||||
)))
|
||||
|
||||
|
||||
def load_data(filename):
|
||||
def load_data(filename):
|
||||
"""loads given JSON file from `testdata` sub folder and returns content"""
|
||||
with open(
|
||||
currentdir + '/testdata/%s.json' % filename, 'r', encoding='utf-8'
|
||||
@@ -30,7 +30,7 @@ def load_data(filename):
|
||||
|
||||
|
||||
class TestSrpManager(TestCase):
|
||||
|
||||
|
||||
def test_can_extract_kill_id(self):
|
||||
link = 'https://zkillboard.com/kill/81973979/'
|
||||
expected = 81973979
|
||||
@@ -52,11 +52,11 @@ class TestSrpManager(TestCase):
|
||||
self.assertEqual(ship_type, 19720)
|
||||
self.assertEqual(ship_value, 3177859026.86)
|
||||
self.assertEqual(victim_id, 93330670)
|
||||
|
||||
|
||||
@patch(MODULE_PATH + '.requests.get')
|
||||
def test_invalid_id_for_zkb_raises_exception(self, mock_get):
|
||||
mock_get.return_value.json.return_value = ['']
|
||||
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
SRPManager.get_kill_data(81973979)
|
||||
|
||||
@@ -77,7 +77,7 @@ class TestSrpManager(TestCase):
|
||||
|
||||
def test_pending_requests_count_for_user(self):
|
||||
user = AuthUtils.create_member("Bruce Wayne")
|
||||
|
||||
|
||||
# when no permission to approve SRP requests
|
||||
# then return None
|
||||
self.assertIsNone(SRPManager.pending_requests_count_for_user(user))
|
||||
@@ -88,7 +88,7 @@ class TestSrpManager(TestCase):
|
||||
AuthUtils.add_permission_to_user_by_name("auth.srp_management", user)
|
||||
user = User.objects.get(pk=user.pk)
|
||||
self.assertEqual(SRPManager.pending_requests_count_for_user(user), 0)
|
||||
|
||||
|
||||
# given permission to approve SRP requests
|
||||
# when 1 pending request
|
||||
# then return 1
|
||||
|
||||
Reference in New Issue
Block a user