Exemplo n.º 1
0
    def setUp(self):
        """Creates a new app instance for every test case."""
        super(MainTest, self).setUp()
        self.testbed.init_user_stub()

        # When called during a taskqueue, the call to get_app_version() may fail so
        # pre-fetch it.
        version = utils.get_app_version()
        self.mock(utils, 'get_task_queue_host', lambda: version)
        self.source_ip = '192.168.0.1'
        self.app_frontend = webtest.TestApp(
            handlers_frontend.create_application(debug=True),
            extra_environ={'REMOTE_ADDR': self.source_ip})
        # This is awkward but both the frontend and backend applications uses the
        # same template variables.
        template.reset()
        self.app_backend = webtest.TestApp(
            handlers_backend.create_application(debug=True),
            extra_environ={'REMOTE_ADDR': self.source_ip})
        # Tasks are enqueued on the backend.
        self.app = self.app_backend

        self.auth_app = webtest.TestApp(
            auth.create_wsgi_application(debug=True),
            extra_environ={
                'REMOTE_ADDR': self.source_ip,
                'SERVER_SOFTWARE': os.environ['SERVER_SOFTWARE'],
            })

        full_access_group = config.settings().auth.full_access_group
        readonly_access_group = config.settings().auth.readonly_access_group

        auth.bootstrap_group(
            auth.ADMIN_GROUP,
            [auth.Identity(auth.IDENTITY_USER, '*****@*****.**')])
        auth.bootstrap_group(
            readonly_access_group,
            [auth.Identity(auth.IDENTITY_USER, '*****@*****.**')])
        auth.bootstrap_group(
            full_access_group,
            [auth.Identity(auth.IDENTITY_USER, '*****@*****.**')])
        # TODO(maruel): Create a BOTS_GROUP.

        self.set_as_anonymous()
Exemplo n.º 2
0
  def setUp(self):
    """Creates a new app instance for every test case."""
    super(MainTest, self).setUp()
    self.testbed.init_user_stub()

    # When called during a taskqueue, the call to get_app_version() may fail so
    # pre-fetch it.
    version = utils.get_app_version()
    self.mock(utils, 'get_task_queue_host', lambda: version)
    self.source_ip = '192.168.0.1'
    self.app_frontend = webtest.TestApp(
        handlers_frontend.create_application(debug=True),
        extra_environ={'REMOTE_ADDR': self.source_ip})
    # This is awkward but both the frontend and backend applications uses the
    # same template variables.
    template.reset()
    self.app_backend = webtest.TestApp(
        handlers_backend.create_application(debug=True),
        extra_environ={'REMOTE_ADDR': self.source_ip})
    # Tasks are enqueued on the backend.
    self.app = self.app_backend

    self.auth_app = webtest.TestApp(
        auth.create_wsgi_application(debug=True),
        extra_environ={
          'REMOTE_ADDR': self.source_ip,
          'SERVER_SOFTWARE': os.environ['SERVER_SOFTWARE'],
        })

    auth.bootstrap_group(
        auth.ADMIN_GROUP,
        [auth.Identity(auth.IDENTITY_USER, '*****@*****.**')])
    auth.bootstrap_group(
        acl.READONLY_ACCESS_GROUP,
        [auth.Identity(auth.IDENTITY_USER, '*****@*****.**')])
    auth.bootstrap_group(
        acl.FULL_ACCESS_GROUP,
        [auth.Identity(auth.IDENTITY_USER, '*****@*****.**')])
    # TODO(maruel): Create a BOTS_GROUP.

    self.set_as_anonymous()
Exemplo n.º 3
0
 def tearDown(self):
     template.reset()
     super(Ereporter2Test, self).tearDown()
Exemplo n.º 4
0
 def tearDown(self):
   template.reset()
   super(MainTest, self).tearDown()
 def tearDown(self):
     template.reset()
     super(MainTest, self).tearDown()
Exemplo n.º 6
0
 def tearDown(self):
   template.reset()
   super(Ereporter2Test, self).tearDown()
Exemplo n.º 7
0
def reset():
    template.reset()
Exemplo n.º 8
0
 def tearDown(self):
   template.reset()
   super(Base, self).tearDown()
Exemplo n.º 9
0
 def tearDown(self):
     try:
         template.reset()
     finally:
         super(AppTestBase, self).tearDown()
Exemplo n.º 10
0
 def tearDown(self):
   try:
     template.reset()
   finally:
     super(FrontendHandlersTest, self).tearDown()
Exemplo n.º 11
0
 def tearDown(self):
     try:
         template.reset()
     finally:
         super(FrontendHandlersTest, self).tearDown()
Exemplo n.º 12
0
 def tearDown(self):
   try:
     template.reset()
   finally:
     super(AppTestBase, self).tearDown()
Exemplo n.º 13
0
 def tearDown(self):
   template.reset()
   super(Base, self).tearDown()