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 API endpoint for hacknight details #172

Conversation

w1stler
Copy link
Member

@w1stler w1stler commented Sep 11, 2019

To test, use Postman:
GET localhost:5000/hacknights/1/details/

@w1stler w1stler requested a review from a team September 11, 2019 19:06
@w1stler
Copy link
Member Author

w1stler commented Sep 11, 2019

  • frontend test fixes for master branch

@w1stler
Copy link
Member Author

w1stler commented Sep 12, 2019

I will add some unittests here as well.

Copy link
Member

@magul magul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@w1stler already wrote so, but, please provide unit tests here.

backend/app.py Outdated
@@ -40,3 +40,4 @@ def initialize_extensions(app):
api.add_resource(ParticipantsList, "/participants/")
api.add_resource(ParticipantDetails, "/participants/<int:id>/")
api.add_resource(HacknightList, "/hacknights/")
api.add_resource(HacknightDetails, "/hacknights/<int:id>/details/")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also it shouldn't have /details/ at the end


class HacknightDetails(Resource):
def get(self, id):
hacknight_schema = HacknightSchema(only=('date', 'id', 'participants'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we limit fields using only here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was intentional, as the ticket stated this (only these fields to be returned). Currently we don't have others, so could be removed. :-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it should be removed. I don't even see the word only in issue description so would assume that was to point out all fields in that model.

Copy link
Member

@magul magul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two simple issues


class HacknightDetails(Resource):
def get(self, id):
hacknight_schema = HacknightSchema(only=('date', 'id', 'participants'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it should be removed. I don't even see the word only in issue description so would assume that was to point out all fields in that model.



@pytest.fixture
def add_participants_to_hacknight(app, _db):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can simplify it:

@pytest.fixture
def add_participants_to_hacknight(app, _db):
    HacknightFactory(participants=ParticipantFactory.create_batch(10))
    _db.session.commit()

@magul magul merged commit 6ef99be into CodeForPoznan:master Sep 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants