Ejemplo n.º 1
0
 def test_request_to_show_everything(self):
     jira = MockJira(issues=self.get_test_issue_set())
     slack = MockSlack()
     bot = JiraBot(jira,
                   slack,
                   "AAA",
                   "LABEL",
                   None,
                   "#things",
                   logger=self.logger,
                   supress_quotes=True)
     slack.add_incoming({u'text': u'<@BOTID> show warnings'})
     bot.process_messages()
     self.assertEqual(1, len(slack.outgoing_messages))
Ejemplo n.º 2
0
 def test_request_to_show_progress_chart(self):
     jira = MockJira().with_n_fake_issues(50)
     slack = MockSlack()
     bot = JiraBot(jira,
                   slack,
                   "XXX",
                   "LABEL",
                   "#channel_4",
                   3,
                   logger=self.logger,
                   supress_quotes=True)
     slack.add_incoming({u'text': u'<@BOTID> chart progress'})
     bot.process_messages()
     self.assertEqual(1, len(slack.uploaded_files))
     self.assertEqual(0, len(slack.outgoing_messages))
Ejemplo n.º 3
0
 def test_request_status_summary(self):
     jira = MockJira(issues=self.get_test_issue_set())
     slack = MockSlack()
     bot = JiraBot(jira,
                   slack,
                   "AAA",
                   "LABEL",
                   None,
                   "#things",
                   logger=self.logger,
                   supress_quotes=True)
     slack.add_incoming({u'text': u'<@BOTID> status summary'})
     bot.process_messages()
     self.assertEqual(1, len(slack.outgoing_messages))
     msg = slack.outgoing_messages[0]["message"].lower()
     self.assertTrue("backlog: *3*" in msg)
     self.assertTrue("to do: *1*" in msg)
     self.assertTrue("in progress: *2*" in msg)
Ejemplo n.º 4
0
 def test_unknown_command(self):
     jira = MockJira(issues=[])
     slack = MockSlack()
     bot = JiraBot(jira,
                   slack,
                   "AAA",
                   "LABEL",
                   None,
                   "#things",
                   logger=self.logger,
                   supress_quotes=True)
     slack.add_incoming({
         u'text': u'<@BOTID> herrings are obfuscation cheese',
         u'user': u'USER_ID'
     })
     bot.process_messages()
     self.assertEqual(1, len(slack.outgoing_messages))
     self.assertTrue("<@USER_ID>" in slack.outgoing_messages[0]["message"])
Ejemplo n.º 5
0
    def do_leaderboard(self, msg="leader board", issues=None):
        if not issues:
            issues = self.get_completed_issue_set()

        jira = MockJira(issues=issues)
        slack = MockSlack(name_lookup=self.get_name_lookup_for_leaderboard())
        bot = JiraBot(jira,
                      slack,
                      "XXX",
                      "LABEL",
                      None,
                      "#channel_name",
                      3,
                      logger=self.logger,
                      supress_quotes=True)
        slack.add_incoming({u'text': u'<@BOTID> {0}'.format(msg)})
        bot.process_messages()
        self.assertEqual(len(slack.outgoing_messages), 1)
        self.assertEqual("#channel_name",
                         slack.outgoing_messages[0]["recipient"])
        message = slack.outgoing_messages[0]["message"]
        return message