Skip to content

Commit

Permalink
Merge pull request #340 from hikka-io/fix/rename-to-restricted
Browse files Browse the repository at this point in the history
Rename 'banned' to 'restricted'
  • Loading branch information
Darky2020 authored Aug 28, 2024
2 parents fc780f5 + b3733e7 commit 016776a
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@
ROLE_USER = "user"
ROLE_MODERATOR = "moderator"
ROLE_ADMIN = "admin"
ROLE_BANNED = "banned"
ROLE_RESTRICTED = "restricted"
ROLE_NOT_ACTIVATED = "not_activated"
ROLE_DELETED = "deleted"

Expand Down Expand Up @@ -394,7 +394,7 @@
PERMISSION_UPLOAD_AVATAR,
PERMISSION_UPLOAD_COVER,
],
ROLE_BANNED: [],
ROLE_RESTRICTED: [],
ROLE_DELETED: [],
}

Expand Down
15 changes: 15 additions & 0 deletions tests/comments/test_comments_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,18 @@ async def test_comments_write_empty_markdown(

assert response.status_code == status.HTTP_400_BAD_REQUEST
assert response.json()["code"] == "system:validation_error"


async def test_comments_write_bad_permission(
client,
aggregator_anime,
aggregator_anime_info,
create_dummy_user_restricted,
get_dummy_token,
):
response = await request_comments_write(
client, get_dummy_token, "edit", "17", "First comment, yay!"
)

assert response.status_code == status.HTTP_403_FORBIDDEN
assert response.json()["code"] == "permission:denied"
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,12 @@ async def create_dummy_user(test_session):


@pytest.fixture
async def create_dummy_user_banned(test_session):
async def create_dummy_user_restricted(test_session):
return await helpers.create_user(
test_session,
username="dummy",
email="[email protected]",
role=constants.ROLE_BANNED,
role=constants.ROLE_RESTRICTED,
)


Expand Down
2 changes: 1 addition & 1 deletion tests/edit/test_edit_close.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ async def test_edit_close_bad_permission(
aggregator_anime,
aggregator_anime_info,
create_test_user,
create_dummy_user_banned,
create_dummy_user_restricted,
get_test_token,
get_dummy_token,
test_session,
Expand Down
2 changes: 1 addition & 1 deletion tests/edit/test_edit_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ async def test_edit_create_bad_permission(
client,
aggregator_anime,
aggregator_anime_info,
create_dummy_user_banned,
create_dummy_user_restricted,
get_dummy_token,
test_session,
):
Expand Down
2 changes: 1 addition & 1 deletion tests/upload/test_upload_avatar.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async def test_upload_avatar(

async def test_upload_avatar_bad_permission(
client,
create_dummy_user_banned,
create_dummy_user_restricted,
get_dummy_token,
mock_s3_upload_file,
):
Expand Down
2 changes: 1 addition & 1 deletion tests/upload/test_upload_cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async def test_upload_cover(

async def test_upload_cover_bad_permission(
client,
create_dummy_user_banned,
create_dummy_user_restricted,
get_dummy_token,
mock_s3_upload_file,
):
Expand Down

0 comments on commit 016776a

Please sign in to comment.