-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathload_handler_test.py
33 lines (26 loc) · 1.06 KB
/
load_handler_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import unittest
import webtest
from google.appengine.api import memcache
from google.appengine.ext import ndb
from google.appengine.ext import testbed
import main
class LoadHandlerTest(unittest.TestCase):
def setUp(self):
# First, create an instance of the Testbed class.
self.testbed = testbed.Testbed()
# Then activate the testbed, which prepares the service stubs for use.
self.testbed.activate()
# Next, declare which service stubs you want to use.
self.testbed.init_datastore_v3_stub()
self.testbed.init_memcache_stub()
# Clear ndb's in-context cache between tests.
# This prevents data from leaking between tests.
# Alternatively, you could disable caching by
# using ndb.get_context().set_cache_policy(False)
ndb.get_context().clear_cache()
def tearDown(self):
self.testbed.deactivate()
def testLoad(self):
app = webtest.TestApp(main.app)
response = app.get('/webnote/tc%252520testing')
self.assertEqual(200, response.status_int)