Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[62] create endpoint for hacknight details #182

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backend/resources/hacknight.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def post(self):


class HacknightDetails(Resource):
@jwt_required
def get(self, id):
hacknight_schema = HacknightSchema()

Expand Down
15 changes: 15 additions & 0 deletions backend/tests/test_hacknight_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,21 @@ def test_get_hacknight_details_authorized(
assert len(response['hacknights']['participants']) == 10


def test_no_hacknights_in_hacknights_participants(
client, access_token, add_participants_to_hacknight
):
"""Test get hacknight details for logged in user."""
rv = client.get(
'/hacknights/1/',
headers={'Authorization': 'Bearer {}'.format(access_token)}
)
response = rv.get_json()

for participant in response['hacknights']['participants']:
assert 'hacknights' not in participant
assert rv.status_code == HTTPStatus.OK


def test_get_hacknight_details_unauthorized(
client, add_participants_to_hacknight
):
Expand Down