Skip to content

Commit

Permalink
Flake8 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
anodos325 committed Dec 14, 2024
1 parent 905dca5 commit 2fa98ef
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
6 changes: 1 addition & 5 deletions src/middlewared/middlewared/plugins/test/mock.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from middlewared.alert.base import (
AlertCategory, AlertClass, AlertLevel, OneShotAlertClass, SimpleOneShotAlertClass
)
from middlewared.alert.base import AlertCategory, AlertClass, AlertLevel, SimpleOneShotAlertClass
from middlewared.role import Role
from middlewared.service import CallError, Service

Expand Down Expand Up @@ -45,7 +43,6 @@ def method(*args, **kwargs):
async def remove_mock(self, name, args):
self.middleware.remove_mock(name, args)


async def set_mock_role(self):
"""
adds a MOCK role to role_manager and grants access to test.test1 and test.test2
Expand All @@ -63,7 +60,6 @@ async def set_mock_role(self):

await self.middleware.call('alert.oneshot_create', 'SystemTesting')


# Dummy methods to mock for internal infrastructure testing (i.e. jobs manager)
# When these are mocked over they will be available to users with the "MOCK" role.

Expand Down
11 changes: 5 additions & 6 deletions tests/api2/test_stig.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
import pytest

from middlewared.service_exception import CallError
from middlewared.service_exception import ValidationErrors as Verr
from middlewared.test.integration.assets.account import user
from middlewared.service_exception import ValidationErrors as Verr
from middlewared.test.integration.assets.product import product_type, set_fips_available
from middlewared.test.integration.assets.two_factor_auth import (
enabled_twofactor_auth, get_user_secret, get_2fa_totp_token
)
from middlewared.test.integration.utils import call, client, ssh
from middlewared.test.integration.utils import call, client
from truenas_api_client import ValidationErrors


Expand Down Expand Up @@ -109,7 +108,7 @@ def setup_stig(two_factor_full_admin):
c.call('system.security.update', {'enable_fips': False, 'enable_gpos_stig': False}, job=True)


# The order of the following tests is significant. We gradully fixtures that have module scope
# The order of the following tests is significant. We gradually add fixtures that have module scope
# as we finish checking for correct ValidationErrors

def test_nonenterprise_fail(community_product):
Expand Down Expand Up @@ -166,7 +165,7 @@ def test_stig_enabled_authenticator_assurance_level(setup_stig):

def test_stig_roles_decrease(setup_stig):

# We need new webosocket connection to verify that privileges
# We need new websocket connection to verify that privileges
# are appropriately decreased
with client(auth=None) as c:
do_stig_auth(c, setup_stig['user_obj'], setup_stig['secret'])
Expand All @@ -183,7 +182,7 @@ def test_stig_roles_decrease(setup_stig):


def test_stig_smb_auth_disabled(setup_stig):
# We need new webosocket connection to verify that privileges
# We need new websocket connection to verify that privileges
# are appropriately decreased

smb_user_cnt = setup_stig['connection'].call('user.query', [['smb', '=', True]], {'count': True})
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_role_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def test__roles_have_correct_stig_assignment(nostig_roles, role_name):
('FULL_ADMIN', '*', None, {'*'}),
('FULL_ADMIN', 'CALL', security.STIGType.GPOS, FULL_ADMIN_STIG),
])
def test__roles_have_corect_allowlist(role_manager, role, method, enabled_stig_type, resources):
def test__roles_have_correct_allowlist(role_manager, role, method, enabled_stig_type, resources):
allowlist = role_manager.allowlist_for_role(role, enabled_stig_type)
allowlist_resources = set()
for entry in allowlist:
Expand Down

0 comments on commit 2fa98ef

Please sign in to comment.