-
Notifications
You must be signed in to change notification settings - Fork 310
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
Conversation
98ed4bf
to
1f4e69b
Compare
@@ -0,0 +1 @@ | |||
lib |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
||
|
||
# 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.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
import contextlib | ||
import json | ||
import sys | ||
from StringIO import StringIO |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
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.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
||
# 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.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -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.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
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.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
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.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
||
|
||
@pytest.mark.skipif( | ||
'SKIP_APP_ENGINE_SYSTEM_TEST' in os.environ, |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
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.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
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.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
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.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Has #58 as a diffbase.Resolves #41, progress towards #55.