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

LB-393: Upgrade flask to 1.0.2 #453

Merged
merged 7 commits into from Nov 7, 2018
Merged

LB-393: Upgrade flask to 1.0.2 #453

merged 7 commits into from Nov 7, 2018

Conversation

Ge0rg3
Copy link
Contributor

@Ge0rg3 Ge0rg3 commented Nov 5, 2018

Summary

  • This is a…
    • Bug fix
    • Feature addition
    • Refactoring
    • Minor / simple change (like a typo)
    • Other
  • Describe this change in 1-2 sentences:
    Updating Flask to 1.0.4.

Problem

The previous version of Flask was outdated, so this updates the BrainzUtils package (and therefore Flask).

Solution

The response in one of the test cases includes debug tools data, including text such as:

CPU: 144.13ms (159.74ms)

This means that the two responses will never be identical.
By comparing only the first 100 characters, we compare enough to know whether the case sensitivity worked, and we also ignore all of the debugging info.

The response here includes debug tools data, including text such as:
<small>CPU: 144.13ms (159.74ms)</small>
This means that the two responses will never be identical.
By comparing only the first 100 characters, we compare enough to know whether the case sensitivity worked, and we also ignore all of the debugging info.
@Ge0rg3 Ge0rg3 changed the title Update flask LB-393: Upgrade flask to 1.0.2 Nov 5, 2018
Related to LB-393. Refactored test_username_case to be more efficient.
We cannot use the assertContext function here, as it doesn't let us read its child properties.
By using get_context_variable, we can get the "user" object, and then read its musicbrainz_id attribute.
Refactor test case for username cases, so that the entire User object is compared, instead of just the musicbrainz_id attribute.
Added a second test case for testing usernames, and also refactored test case to avoid issues with SQLAlchemy's ResultProxy.
Change the user data type from a dict to an object in user tests, so that (i) it is more readable, and (b) we can query with assertContext for the test_username_case test case.

We use db_user.get_or_create instead of just create() so that the user is only created if it doesn't already exist, but we don't store the output since it's returned as a dict.
Removed two lines that weren't needed.
Copy link
Collaborator

@alastair alastair left a comment

Choose a reason for hiding this comment

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

looks good! Thanks for working through all the changes, I think we've left this code in a better state than it was before 🎉

@paramsingh paramsingh merged commit 8f4e43b into metabrainz:master Nov 7, 2018
@Ge0rg3 Ge0rg3 deleted the Update-Flask branch November 7, 2018 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants