Beispiel #1
0
    def setUp(self):
        super(BotAuthTest, self).setUp()

        self.logs = []
        self.mock(logging, 'error', lambda l, *_args: self.logs.append(l))

        auth.bootstrap_ip_whitelist(auth.BOTS_IP_WHITELIST,
                                    ['1.2.3.4', '1.2.3.5'])
        auth.bootstrap_ip_whitelist('ip_whitelist', ['1.1.1.1', '1.2.3.4'])

        auth_testing.reset_local_state()
Beispiel #2
0
    def setUp(self):
        super(BotAuthTest, self).setUp()

        # Mock this out, otherwise it tries to fetch settings.cfg.
        self.mock(srv_cfg, 'get_ui_client_id', lambda: None)

        self.logs = []
        self.mock(logging, 'error',
                  lambda l, *_args: self.logs.append(l % _args))

        auth.bootstrap_ip_whitelist(auth.bots_ip_whitelist(),
                                    ['1.2.3.4', '1.2.3.5'])
        auth.bootstrap_ip_whitelist('ip_whitelist', ['1.1.1.1', '1.2.3.4'])

        auth_testing.reset_local_state()
Beispiel #3
0
 def set_as_bot(self):
     self.set_as_anonymous()
     auth.bootstrap_ip_whitelist(auth.bots_ip_whitelist(), [self.source_ip])
     auth_testing.reset_local_state()
     auth_testing.mock_get_current_identity(self,
                                            auth.IP_WHITELISTED_BOT_ID)
Beispiel #4
0
 def whitelist_self(self):
     auth.bootstrap_ip_whitelist(auth.BOTS_IP_WHITELIST, [self.source_ip])
Beispiel #5
0
 def set_as_bot(self):
   self.set_as_anonymous()
   auth.bootstrap_ip_whitelist(auth.BOTS_IP_WHITELIST, [self.source_ip])
   auth_testing.reset_local_state()
   auth_testing.mock_get_current_identity(
       self, auth.Identity.from_bytes('bot:' + self.source_ip))
Beispiel #6
0
 def set_as_bot(self):
     self.set_as_anonymous()
     auth.bootstrap_ip_whitelist(auth.BOTS_IP_WHITELIST, [self.source_ip])
Beispiel #7
0
 def whitelist_self(self):
   auth.bootstrap_ip_whitelist(auth.BOTS_IP_WHITELIST, [self.source_ip])
Beispiel #8
0
 def set_as_bot(self):
     self.set_as_anonymous()
     auth.bootstrap_ip_whitelist(auth.BOTS_IP_WHITELIST, [self.source_ip])
     auth_testing.reset_local_state()
     auth_testing.mock_get_current_identity(
         self, auth.Identity.from_bytes('bot:' + self.source_ip))
Beispiel #9
0
 def set_as_bot(self):
   self.set_as_anonymous()
   auth.bootstrap_ip_whitelist(auth.BOTS_IP_WHITELIST, [self.source_ip])