Exemple #1
0
    def test_append_redmine_summary_only_first_3(self):
        runner = MagicMock()

        mattermost = MattermostNotifier(runner)

        l = [
            TogglEntry(None, 3600, self.today, 777, "test #333",
                       self.redmine_config),
            TogglEntry(None, 3600, self.today, 777, "test #333",
                       self.redmine_config),
            TogglEntry(None, 3600, self.today, 777, "test #333",
                       self.redmine_config),
            TogglEntry(None, 3600, self.today, 777, "test #333",
                       self.redmine_config),
            TogglEntry(None, 0.5 * 3600, self.today, 778, "test #334",
                       self.redmine_config),
            TogglEntry(None, 2 * 3600, self.today, 778, "test #335",
                       self.redmine_config),
            TogglEntry(None, 10 * 3600, self.today, 778, "test #400",
                       self.redmine_config),
        ]

        mattermost._MattermostNotifier__append_redmine_summary(l)
        mattermost.send()

        text = """---
**Redmine summary**
You spent most time on:
- #400: 10.0 h
- #333: 4.0 h
- #335: 2.0 h
"""

        runner.send.assert_called_with(text)
Exemple #2
0
    def test_append_redmine_summary_no_entries_no_summary(self):
        runner = MagicMock()

        mattermost = MattermostNotifier(runner)

        l = [
            TogglEntry(None, 3600, self.today, 777, "test 333",
                       self.redmine_config)
        ]

        mattermost._MattermostNotifier__append_redmine_summary(l)
        mattermost.send()

        text = ""

        runner.send.assert_called_with(text)