def slack_client(): mock_opts = salt.config.DEFAULT_MINION_OPTS.copy() token = "xoxb-xxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx" with patch.dict(slack.__opts__, mock_opts): with patch("slackclient.SlackClient.rtm_connect", MagicMock(return_value=True)): slack_client = slack.SlackClient(token) yield slack_client
def setUp(self): mock_opts = salt.config.DEFAULT_MINION_OPTS.copy() token = 'xoxb-xxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx' with patch.dict(slack.__opts__, mock_opts): with patch('slackclient.SlackClient.rtm_connect', MagicMock(return_value=True)): self.client = slack.SlackClient(token)