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

Test add-streaming-sdk #50

Merged
merged 4 commits into from
Feb 7, 2020
Merged

Conversation

carkod
Copy link
Contributor

@carkod carkod commented Jan 30, 2020

Done

  • Implementation of the Streaming SDK Test streaming endpoints #17 using example parameters (max resolution available on landscape mode)
  • Unit and mocked integration tests

QA:

  • Check out this feature branch
  • Run the site using the command ./run serve
  • Turn on the VPN
  • View the site locally in your web browser at: http://0.0.0.0:8043/demo
  • If you don't have access you need to ask for an invitation code and hit http://0.0.0.0:8043/login?invitation_code=XXXXX&next=/demo where XXXXX is where your invitation code goes.
  • Once you log in, you should see the demo "Big Buggy Racing" game loading

A few considerations:

  • The game may take some time to load. If it doesn't eventually load, you'd need to refresh the page.
  • Current configuration uses keyboard instead of touch. Use arrow keys to control the buggy.
  • Sometimes, it might be difficult to play the game, as there is some delay.

Issue / Cards:

@carkod carkod self-assigned this Jan 30, 2020
@webteam-app
Copy link

templates/demo.html Outdated Show resolved Hide resolved
@codecov-io
Copy link

codecov-io commented Jan 31, 2020

Codecov Report

Merging #50 into master will decrease coverage by 0.58%.
The diff coverage is 33.33%.

Impacted Files Coverage Δ
tests/test_routes.py 100% <ø> (ø) ⬆️
webapp/app.py 57.74% <33.33%> (ø) ⬆️

@carkod carkod mentioned this pull request Jan 31, 2020
@carkod carkod force-pushed the test/add-streaming-sdk branch 7 times, most recently from 1435fa2 to 5ee2618 Compare February 3, 2020 14:37
@carkod carkod force-pushed the test/add-streaming-sdk branch 3 times, most recently from 872c6c2 to a9fbf15 Compare February 3, 2020 15:08
tests/test_api.py Outdated Show resolved Hide resolved
@carkod carkod changed the title WIP Test/add-streaming-sdk Test/add-streaming-sdk Feb 4, 2020
@carkod carkod changed the title Test/add-streaming-sdk Test add-streaming-sdk Feb 4, 2020
@carkod carkod linked an issue Feb 5, 2020 that may be closed by this pull request
@carkod carkod requested a review from tbille February 6, 2020 10:00
@carkod carkod force-pushed the test/add-streaming-sdk branch 3 times, most recently from fe2a043 to 46ef183 Compare February 6, 2020 11:30

openid_macaroon = MacaroonRequest(caveat_id=self.caveat_id)
self.assertEqual(
openid_macaroon.getExtensionArgs(), self.request_result
Copy link
Contributor

Choose a reason for hiding this comment

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

Here are you simply testing internal logic of the MacaroonRequest library? We shouldn't test other people's code directly - that code should be tested by them, but even if it hasn't we should test it works through testing our usage of their module, rather than the module itself.

Again, I'd suggest removing this test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, it's not really a library, it's just a module I took from snapcraft. It was not unit tested on that project.

)

# Make API call
response = _api_request("/1.0/login", method="POST", json=data)
Copy link
Contributor

Choose a reason for hiding this comment

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

If we think about what you're testing here - I think you're testing 2 things:

  • That if you mock the API endpoint /1.0/login with responses, that it genuinely returns the data in the mock
  • That the _api_request method successfully adds {ANBOXCLOUD_API_BASE} to the beginning of the URL it's passed, and that it returns the content of response.json()

To me, neither of these are particularly consequential. The first is effectively just making sure the responses library works, and the second is some very small internal logic of _api_request. I think if you're gonna add tests you should think about testing something more consequential.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know how to improve this. Should I just do it with VCR?

@nottrobin
Copy link
Contributor

I get this:

image

Copy link
Contributor

@nottrobin nottrobin left a comment

Choose a reason for hiding this comment

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

OK works for me in Chrome. In Firefox I get an error, as mentioned above. I think it's fine to merge this so we can do further testing though, since it's only accessible to people who know it's there and have invite codes.

@nottrobin
Copy link
Contributor

Filed: #62

@carkod carkod merged commit c615c2b into canonical:master Feb 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement views for streaming API
7 participants