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

Add App Engine system tests #59

Merged
merged 3 commits into from
Oct 27, 2016
Merged

Add App Engine system tests #59

merged 3 commits into from
Oct 27, 2016

Conversation

theacodes
Copy link
Contributor

@theacodes theacodes commented Oct 26, 2016

Has #58 as a diffbase.

Resolves #41, progress towards #55.

@theacodes theacodes added this to the 1.0.0 milestone Oct 26, 2016
@@ -0,0 +1 @@
lib

This comment was marked as spam.



# Patch os.path.expanduser. This should be fixed in GAE
# versions released after Nov 2016.

This comment was marked as spam.

This comment was marked as spam.

import contextlib
import json
import sys
from StringIO import StringIO

This comment was marked as spam.

This comment was marked as spam.

response = HTTP_REQUEST(url=url, method='GET')
token_info = json.loads(response.data.decode('utf-8'))

assert token_info['scope'] == EMAIL_SCOPE

This comment was marked as spam.

This comment was marked as spam.


# Get token info and verify scope
url = _helpers.update_query(TOKEN_INFO_URL, {
'access_token': scoped_credentials.token

This comment was marked as spam.

This comment was marked as spam.

@@ -0,0 +1,3 @@
urllib3
# Relative path to google-auth-python's source.
../../..

This comment was marked as spam.

This comment was marked as spam.

def vendor_app_dependencies():
"""Vendors in the test application's third-party dependencies."""
subprocess.check_call(
['pip', 'install', '-t', 'lib', '-r', 'requirements.txt'])

This comment was marked as spam.

This comment was marked as spam.

def deploy_app():
"""Deploys the test application using gcloud."""
subprocess.check_call(
['gcloud', 'app', 'deploy', '-q', 'app.yaml'])

This comment was marked as spam.

This comment was marked as spam.



@pytest.mark.skipif(
'SKIP_APP_ENGINE_SYSTEM_TEST' in os.environ,

This comment was marked as spam.

This comment was marked as spam.

reason='Explicitly skipping App Engine system tests.')
def test_live_application(app, http_request):
response = http_request(method='GET', url=app)
assert response.status == 200, response.data.decode('utf-8')

This comment was marked as spam.

This comment was marked as spam.

output = (
'Test {} failed: {}\n\n'
'Stacktrace:\n{}\n\n'
'Captured output:\n{}').format(

This comment was marked as spam.

This comment was marked as spam.

output += 'Captured output:\n{}'.format(capsys.getvalue())
tests = (test_credentials, test_default)

for test in tests:

This comment was marked as spam.

This comment was marked as spam.

@theacodes theacodes merged commit 7a27f47 into master Oct 27, 2016
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.

None yet

2 participants