Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 67353b0

Browse filesBrowse files
author
Jon Wayne Parrott
committed
Fix several tests
Change-Id: Iaed4c0c3c656f32157ee5878eb34e0b2c8664253
1 parent 292cbea commit 67353b0
Copy full SHA for 67353b0

File tree

Expand file treeCollapse file tree

6 files changed

+32
-16
lines changed
Filter options
Expand file treeCollapse file tree

6 files changed

+32
-16
lines changed

‎iap/app_engine_app/app.yaml

Copy file name to clipboardExpand all lines: iap/app_engine_app/app.yaml
-4Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,3 @@ threadsafe: true
55
handlers:
66
- url: /.*
77
script: iap_demo.app
8-
9-
libraries:
10-
- name: webapp2
11-
version: latest
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright 2016 Google Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from google.appengine.ext import vendor
16+
17+
# Add any libraries installed in the "lib" folder.
18+
vendor.add('lib')

‎iap/app_engine_app/iap_demo.py

Copy file name to clipboardExpand all lines: iap/app_engine_app/iap_demo.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,12 @@
3535

3636
@app.route('/')
3737
def echo_jwt():
38-
return flask.request.headers.get('x-goog-authenticated-user-jwt')
38+
return 'x-goog-authenticated-user-jwt: {}'.format(
39+
flask.request.headers.get('x-goog-authenticated-user-jwt'))
3940

4041

4142
@app.route('/identity')
4243
def show_identity():
4344
user = users.get_current_user()
44-
return '<p>Authenticated as {} ({}).</p>'.format(
45+
return 'Authenticated as {} ({})'.format(
4546
user.email(), user.user_id())

‎iap/app_engine_app/requirements.txt

Copy file name to clipboard
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
flask==0.12.0

‎iap/iap_test.py

Copy file name to clipboardExpand all lines: iap/iap_test.py
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,21 @@
1313
# limitations under the License.
1414

1515
"""Test script for Identity-Aware Proxy code samples."""
16-
import os
1716

1817
from gcp.testing.flaky import flaky
1918

2019
import make_iap_request
2120
import validate_jwt
2221

23-
2422
# The hostname of an application protected by Identity-Aware Proxy.
2523
# When a request is made to https://${JWT_REFLECT_HOSTNAME}/, the
2624
# application should respond with the value of the
2725
# X-Goog-Authenticated-User-JWT (and nothing else.) The
2826
# app_engine_app/ subdirectory contains an App Engine standard
2927
# environment app that does this.
30-
GOOGLE_CLOUD_PROJECT = os.getenv('GOOGLE_CLOUD_PROJECT')
31-
assert GOOGLE_CLOUD_PROJECT
32-
JWT_REFLECT_HOSTNAME = '{}.appspot.com'.format(GOOGLE_CLOUD_PROJECT)
28+
# The project must have the service account used by this test added as a
29+
# member of the project.
30+
REFLECT_SERVICE_HOSTNAME = 'gcp-devrel-iap-reflect.appspot.com'
3331

3432

3533
@flaky
@@ -39,9 +37,11 @@ def test_main(cloud_config, capsys):
3937
# the JWT in order to expose it to this test. Thus, this test
4038
# exercises both make_iap_request and validate_jwt.
4139
iap_jwt = make_iap_request.make_iap_request(
42-
'https://{}/'.format(JWT_REFLECT_HOSTNAME))
40+
'https://{}/'.format(REFLECT_SERVICE_HOSTNAME))
41+
iap_jwt = iap_jwt.split(': ').pop()
4342
jwt_validation_result = validate_jwt.validate_iap_jwt(
44-
'https://{}'.format(JWT_REFLECT_HOSTNAME), iap_jwt)
43+
'https://{}'.format(REFLECT_SERVICE_HOSTNAME), iap_jwt)
44+
4545
assert jwt_validation_result[0]
4646
assert jwt_validation_result[1]
4747
assert not jwt_validation_result[2]

‎video/cloud-client/analyze_test.py

Copy file name to clipboardExpand all lines: video/cloud-client/analyze_test.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,22 @@
2727
@pytest.mark.slow
2828
def test_cat_video_shots(capsys, cloud_config):
2929
analyze.analyze_shots(
30-
'gs://{}{}'.format(cloud_config.bucket, SHOTS_FILE_PATH))
30+
'gs://{}{}'.format(cloud_config.storage_bucket, SHOTS_FILE_PATH))
3131
out, _ = capsys.readouterr()
3232
assert 'Scene 1:' in out
3333

3434

3535
@pytest.mark.slow
3636
def test_cat_video_faces(capsys, cloud_config):
3737
analyze.analyze_faces(
38-
'gs://{}{}'.format(cloud_config.bucket, FACES_FILE_PATH))
38+
'gs://{}{}'.format(cloud_config.storage_bucket, FACES_FILE_PATH))
3939
out, _ = capsys.readouterr()
4040
assert 'Thumbnail' in out
4141

4242

4343
@pytest.mark.slow
4444
def test_cat_video_labels(capsys, cloud_config):
4545
analyze.analyze_labels(
46-
'gs://{}{}'.format(cloud_config.bucket, LABELS_FILE_PATH))
46+
'gs://{}{}'.format(cloud_config.storage_bucket, LABELS_FILE_PATH))
4747
out, _ = capsys.readouterr()
4848
assert 'Whiskers' in out

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.