Exemple #1
0
    def test_model_router(self):
        router = Router()
        handler_name = 'handler'
        router.register(handler_name, TestRestHandler)

        self.assertItemsEqual(
            [('^/{}/$'.format(handler_name), TestRestHandler),
             ('^/{}$'.format(handler_name), TestRestHandler),
             ('^/{}/(?P<key>[^/]+)/$'.format(handler_name), TestRestHandler),
             ('^/{}/(?P<key>[^/]+)$'.format(handler_name), TestRestHandler)],
            router.urls)
Exemple #2
0
    def setUp(self):
        self.testbed = testbed.Testbed()
        self.testbed.activate()
        self.testbed.init_datastore_v3_stub()
        self.testbed.init_memcache_stub()

        ndb.get_context().clear_cache()

        router = Router()
        router.register('user', APIUserHandler)
        app = webapp3.WSGIApplication(router.urls)
        self.testapp = webtest.TestApp(app)
Exemple #3
0
    def setUp(self):
        self.testbed = testbed.Testbed()
        self.testbed.activate()
        self.testbed.init_datastore_v3_stub()
        self.testbed.init_memcache_stub()

        ndb.get_context().clear_cache()

        router = Router()
        router.register('user', UserApi)
        app = webapp3.WSGIApplication(router.urls)
        self.testapp = webtest.TestApp(app)
        self.entity = User(email='*****@*****.**',
                           first_name='admin',
                           last_name='test',
                           age=28)
        self.entity.put()