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()
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()
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)
def whitelist_self(self): auth.bootstrap_ip_whitelist(auth.BOTS_IP_WHITELIST, [self.source_ip])
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))
def set_as_bot(self): self.set_as_anonymous() auth.bootstrap_ip_whitelist(auth.BOTS_IP_WHITELIST, [self.source_ip])