Skip to content

Commit

Permalink
fix linting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
hmodi-ns1 committed Jul 19, 2024
1 parent 35c15b0 commit 4b928bf
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 40 deletions.
2 changes: 1 addition & 1 deletion ns1/rest/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class User(resource.BaseResource):
]

def create(
self, name, username, email, callback=None, errback=None, **kwargs
self, name, username, email, callback=None, errback=None, **kwargs
):
body = {"name": name, "username": username, "email": email}

Expand Down
28 changes: 16 additions & 12 deletions tests/unit/test_apikey.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,14 @@ def test_manage_jobs_set_to_true(self, apikey_config, name, url):

z.create(name, permissions={"monitoring": {"manage_jobs": True}})

expected_perms = {"monitoring": {
"manage_jobs": False,
"create_jobs": True,
"update_jobs": True,
"delete_jobs": True,
}}
expected_perms = {
"monitoring": {
"manage_jobs": False,
"create_jobs": True,
"update_jobs": True,
"delete_jobs": True,
}
}
z._make_request.assert_called_once_with(
"PUT",
url,
Expand Down Expand Up @@ -140,12 +142,14 @@ def test_mange_jobs_set_to_true(
ip_whitelist=ip_whitelist,
permissions=perms,
)
expected_perms = {"monitoring": {
"manage_jobs": False,
"create_jobs": True,
"update_jobs": True,
"delete_jobs": True,
}}
expected_perms = {
"monitoring": {
"manage_jobs": False,
"create_jobs": True,
"update_jobs": True,
"delete_jobs": True,
}
}
z._make_request.assert_called_once_with(
"POST",
url,
Expand Down
28 changes: 16 additions & 12 deletions tests/unit/test_team.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,14 @@ def test_manage_jobs_set_to_true(self, team_config, name, url):

z.create(name, permissions={"monitoring": {"manage_jobs": True}})

expected_perms = {"monitoring": {
"manage_jobs": False,
"create_jobs": True,
"update_jobs": True,
"delete_jobs": True,
}}
expected_perms = {
"monitoring": {
"manage_jobs": False,
"create_jobs": True,
"update_jobs": True,
"delete_jobs": True,
}
}
z._make_request.assert_called_once_with(
"PUT",
url,
Expand Down Expand Up @@ -135,12 +137,14 @@ def test_manage_jobs_set_to_true(
z.update(
team_id, name=name, ip_whitelist=ip_whitelist, permissions=perms
)
expected_perms = {"monitoring": {
"manage_jobs": False,
"create_jobs": True,
"update_jobs": True,
"delete_jobs": True,
}}
expected_perms = {
"monitoring": {
"manage_jobs": False,
"create_jobs": True,
"update_jobs": True,
"delete_jobs": True,
}
}
z._make_request.assert_called_once_with(
"POST",
url,
Expand Down
41 changes: 26 additions & 15 deletions tests/unit/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,26 @@ def test_no_permissions_set(self, user_config, name, username, email, url):
"name, username, email, url",
[("test-user", "test-username", "[email protected]", "account/users")],
)
def test_manage_jobs_set_to_true(self, user_config, name, username, email, url):
def test_manage_jobs_set_to_true(
self, user_config, name, username, email, url
):
z = ns1.rest.user.User(user_config)
z._make_request = mock.MagicMock()
z.create(name, username, email, permissions={"monitoring": {"manage_jobs": True}})

expected_perms = {"monitoring": {
"manage_jobs": False,
"create_jobs": True,
"update_jobs": True,
"delete_jobs": True,
}}
z.create(
name,
username,
email,
permissions={"monitoring": {"manage_jobs": True}},
)

expected_perms = {
"monitoring": {
"manage_jobs": False,
"create_jobs": True,
"update_jobs": True,
"delete_jobs": True,
}
}
z._make_request.assert_called_once_with(
"PUT",
url,
Expand Down Expand Up @@ -150,12 +159,14 @@ def test_manage_jobs_set_to_true(
z.update(
username, name=name, ip_whitelist=ip_whitelist, permissions=perms
)
expected_perms = {"monitoring": {
"manage_jobs": False,
"create_jobs": True,
"update_jobs": True,
"delete_jobs": True,
}}
expected_perms = {
"monitoring": {
"manage_jobs": False,
"create_jobs": True,
"update_jobs": True,
"delete_jobs": True,
}
}
z._make_request.assert_called_once_with(
"POST",
url,
Expand Down

0 comments on commit 4b928bf

Please sign in to comment.