8000 Added tests · aldric/python-docs-samples@16f1900 · GitHub
[go: up one dir, main page]

Skip to content

Commit 16f1900

Browse files
committed
Added tests
1 parent 4df7416 commit 16f1900

File tree

3 files changed

+62
-1
lines changed

3 files changed

+62
-1
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,32 @@
1+
# Copyright 2020 Google LLC
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.
114

15+
import main
16+
import os
17+
18+
19+
def test_index():
20+
main.app.testing = True
21+
client = main.app.test_client()
22+
23+
r = client.get('/')
24+
assert r.status_code == 200
25+
assert 'Google is built by a large team ' in r.data.decode('utf-8')
26+
27+
r = client.get('/callback')
28+
assert r.status_code == 200
29+
assert 'Response number 1 is ' in r.data.decode('utf-8')
30+
assert 'Response number 2 is ' in r.data.decode('utf-8')
31+
assert 'Response number 3 is ' in r.data.decode('utf-8')
32+
assert 'Response number 4 is ' in r.data.decode('utf-8')

appengine/standard/migration/urlfetch/requests/main.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,9 @@ def server_error(e):
4141
An internal error occurred: <pre>{}</pre>
4242
See logs for full stacktrace.
4343
""".format(e), 500
44-
# [END app]
44+
# [END app]
45+
46+
47+
if __name__ == '__main__':
48+
# This is used when running locally.
49+
app.run(host='127.0.0.1', port=8080, debug=True)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright 2020 Google LLC
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+
import main
16+
import os
17+
18+
19+
def test_index():
20+
main.app.testing = True
21+
client = main.app.test_client()
22+
23+
r = client.get('/')
24+
assert r.status_code == 200
25+
assert 'Google is built by a large team ' in r.data.decode('utf-8')

0 commit comments

Comments
 (0)
0