File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #
2+ # # Licensed under the Apache License, Version 2.0 (the "License");
3+ # you may not use this file except in compliance with the License.
4+ # # You may obtain a copy of the License at
5+ # #
6+ # # http://www.apache.org/licenses/LICENSE-2.0
7+ # #
8+ # # Unless required by applicable law or agreed to in writing, software
9+ # # distributed under the License is distributed on an "AS IS" BASIS,
10+ # # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+ # # See the License for the specific language governing permissions and
12+ # # limitations under the License.
13+
14+ .PHONY : e2e
15+
16+ VERSION =e2e-test
17+
18+ .PHONY : all
19+ all : deploy
20+
21+ .PHONY : deploy
22+ deploy :
23+ appcfg.py update . -A $(GAE_PROJECT ) --version=$(VERSION )
24+
25+ .PHONY : e2e_test
26+ e2e_test : export GUESTBOOK_URL = http://$(VERSION ) -dot-$(GAE_PROJECT ) .appspot.com
27+ e2e_test : deploy
28+ pip install -r e2e/requirements-dev.txt
29+ python e2e/test_e2e.py
30+
Original file line number Diff line number Diff line change @@ -28,3 +28,25 @@ High Replication Datastore (HRD) and retrieved using a strongly consistent
2828[ 5 ] : http://webapp-improved.appspot.com/
2929[ 6 ] : http://jinja.pocoo.org/docs/
3030[ 7 ] : http://twitter.github.com/bootstrap/
31+
32+
33+ ## E2E Test for this sample app
34+
35+ A Makefile is provided to deploy and run the e2e test.
36+
37+ To run:
38+
39+ export GAE_PROJECT=your-project-id
40+ make
41+
42+ To manually run, install the requirements
43+
44+ pip install -r e2e/requirements-dev.txt
45+
46+ Set the environment variable to point to your deployed app:
47+
48+ export GUESTBOOK_URL="http://guestbook-test-dot-useful-temple-118922.appspot.com/"
49+
50+ Finally, run the test
51+
52+ python e2e/test_e2e.py
Original file line number Diff line number Diff line change 1+ requests == 2.9.1
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python
2+
3+ # Copyright 2016 Google Inc.
4+ #
5+ # Licensed under the Apache License, Version 2.0 (the "License");
6+ # you may not use this file except in compliance with the License.
7+ # You may obtain a copy of the License at
8+ #
9+ # http://www.apache.org/licenses/LICENSE-2.0
10+ #
11+ # Unless required by applicable law or agreed to in writing, software
12+ # distributed under the License is distributed on an "AS IS" BASIS,
13+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+ # See the License for the specific language governing permissions and
15+ # limitations under the License.
16+
17+ import uuid
18+ import os
19+ import requests
20+
21+ URL = os .environ .get ('GUESTBOOK_URL' )
22+
23+
24+ def test_e2e ():
25+ assert URL
26+ print ("Running test against {}" .format (URL ))
27+ r = requests .get (URL )
28+ assert b'Guestbook' in r .content
29+ u = uuid .uuid4 ()
30+ data = {'content' : str (u )}
31+ r = requests .post (URL + '/sign' , data )
32+ assert r .status_code == 200
33+ r = requests .get (URL )
34+ assert str (u ).encode ('utf-8' ) in r .content
35+ print ("Success" )
36+
37+ if __name__ == "__main__" :
38+ test_e2e ()
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python
2+
3+ # Copyright 2016 Google Inc.
4+ #
5+ # Licensed under the Apache License, Version 2.0 (the "License");
6+ # you may not use this file except in compliance with the License.
7+ # You may obtain a copy of the License at
8+ #
9+ # http://www.apache.org/licenses/LICENSE-2.0
10+ #
11+ # Unless required by applicable law or agreed to in writing, software
12+ # distributed under the License is distributed on an "AS IS" BASIS,
13+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+ # See the License for the specific language governing permissions and
15+ # limitations under the License.
16+
117# [START imports]
218import os
319import urllib
You can’t perform that action at this time.
0 commit comments