def mocked_testbot(self, testbot): config = create_config() testbot.bot.plugin_manager.plugins[ 'AccessBot'].get_admin_ids = MagicMock(return_value=[ get_dummy_person(account_name, is_deleted=False) ]) return inject_config(testbot, config)
def mocked_testbot_hide_resource_false(self, testbot): config = create_config() config['HIDE_RESOURCE_TAG'] = 'hide-resource' resources = [ DummyResource("Bbb", {}), DummyResource("Aaa", {'hide-resource': False}) ] return inject_mocks(testbot, config, resources)
def mocked_testbot(self, testbot): config = create_config() config['AUTO_APPROVE_GROUPS_TAG'] = "auto-approve-groups" config['GROUPS_TAG'] = "groups" return inject_mocks( testbot, config, resources=dummy_resources_with_auto_approve_groups())
def mocked_testbot_allow_resource_false(self, testbot): config = create_config() config['ALLOW_RESOURCE_TAG'] = 'allow-resource' resources = [ DummyResource("Bbb", {}), DummyResource("Aaa", {'allow-resource': False}) ] return inject_mocks(testbot, config, resources)
def mocked_testbot(self, testbot): config = create_config() config['USER_ROLES_TAG'] = account_roles_tag return inject_mocks(testbot, config, roles=[DummyRole("Bbb", {}), DummyRole("Aaa", {})], account_permitted_roles=['Aaa'])
def mocked_testbot_with_profile(self, testbot, mocked_user_profile): config = create_config() config['SENDER_EMAIL_OVERRIDE'] = None config['EMAIL_SLACK_FIELD'] = self.alternative_email_tag testbot.bot.sender.userid = 'XXX' testbot.bot.find_user_profile = MagicMock( return_value=mocked_user_profile) return inject_mocks(testbot, config)
def mocked_testbot_with_ratelimited_error(self, testbot): config = create_config() config['SENDER_EMAIL_OVERRIDE'] = None config['EMAIL_SLACK_FIELD'] = self.alternative_email_tag testbot.bot.sender.userid = 'XXX' testbot.bot.find_user_profile = MagicMock( side_effect=get_rate_limited_slack_response_error()) return inject_mocks(testbot, config)
def mocked_testbot_conceal_resource_false(self, testbot): config = create_config() config['CONCEAL_RESOURCE_TAG'] = 'conceal-resource' resources = [ DummyResource("Bbb", {}), DummyResource("Aaa", {'conceal-resource': False}) ] return inject_mocks(testbot, config, resources)
def mocked_testbot(self, testbot): self.raw_messages = [] testbot.bot.send_message = send_message_override( testbot.bot, self.raw_messages) config = create_config() config['ADMIN_TIMEOUT'] = 0 accessbot = testbot.bot.plugin_manager.plugins['AccessBot'] accessbot.config = config return testbot
def mocked_testbot(self, testbot): config = create_config() config['HIDE_ROLE_TAG'] = 'hide-role' return inject_mocks(testbot, config, roles=[ DummyRole("Bbb", {}), DummyRole("Aaa", {'hide-role': 'true'}) ])
def mocked_testbot(self, testbot): config = create_config() config['AUTO_APPROVE_ROLE_TAG'] = 'auto-approve-role' return inject_mocks(testbot, config, roles=[ DummyRole("Bbb", {}), DummyRole("Aaa", {'auto-approve-role': 'true'}) ])
def mocked_testbot(self, testbot): self.raw_messages = [] testbot.bot.send_message = send_message_override( testbot.bot, self.raw_messages) config = create_config() config['ADMIN_TIMEOUT'] = 0 config['APPROVERS_CHANNEL_TAG'] = 'approvers-channel' accessbot = testbot.bot.plugin_manager.plugins['AccessBot'] accessbot.config = config return testbot
def mocked_testbot(self, testbot): config = create_config() config['CONTROL_RESOURCES_ROLE_NAME'] = 'myrole' resources_by_role = [ DummyResource("Bbb in role", {}), DummyResource("Aaa in role", {}) ] return inject_mocks(testbot, config, resources_by_role=resources_by_role)
def mocked_testbot(self, testbot): config = create_config() accessbot = testbot.bot.plugin_manager.plugins['AccessBot'] accessbot.config = config return testbot
def mocked_testbot(self, testbot): config = create_config() return inject_mocks(testbot, config)
def mocked_testbot_allow_role_false(self, testbot): config = create_config() config['ALLOW_ROLE_TAG'] = 'allow-role' roles = [DummyRole("Bbb", {}), DummyRole("Aaa", {'allow-role': False})] return inject_mocks(testbot, config, roles)
def mocked_testbot(self, testbot): config = create_config() config['AUTO_APPROVE_ROLE_TAG'] = "auto-approve-role" return inject_mocks(testbot, config, role_tags={'auto-approve-role': ''})
def mocked_testbot(self, testbot): config = create_config() roles = [DummyRole(self.role, {})] return inject_mocks(testbot, config, roles, throw_no_role_found=True)
def mocked_testbot(self, testbot): config = create_config() config['USER_ROLES_TAG'] = 'sdm-roles' account_tags = {config['USER_ROLES_TAG']: ''} return inject_mocks(testbot, config, self.roles, account_tags, False)
def mocked_testbot(self, testbot): config = create_config() return inject_mocks(testbot, config, role_grant_exists=True)
def mocked_testbot_allow_false(self, testbot): config = create_config() config['ALLOW_ROLE_TAG'] = "allow-role" return inject_mocks(testbot, config, role_tags={'allow-role': False})
def mocked_testbot(self, testbot): config = create_config() config['AUTO_APPROVE_ROLE_ALL'] = True return inject_mocks(testbot, config)