Пример #1
0
    def test_append_summary_two_one_with_redmine_4_hours(self):
        runner = MagicMock()

        mattermost = MattermostNotifier(runner)
        mattermost._MattermostNotifier__append_summary([
            TogglEntry(None, 4 * 3123, self.today, 777, "#666 Hardwork",
                       self.redmine_config)
        ])
        mattermost.send()

        text = """You worked almost less than 4 hours today (exactly 3.47 h), not every day is a perfect day, right? :smirk:.
Huh, not many entries. It means, you did only a couple of tasks, but did it right .. right? :open_mouth:
It seems that more than 75% of your today work had redmine id! So .. you rock :rocket:!"""

        runner.send.assert_called_with(text)
Пример #2
0
    def test_append_summary_10_entries(self):
        runner = MagicMock()

        mattermost = MattermostNotifier(runner)

        e = TogglEntry(None, 4 * 3600, self.today, 777, "#666 Hardwork",
                       self.redmine_config)
        l = []

        for i in range(1, 10):
            l.append(e)

        mattermost._MattermostNotifier__append_summary(l)
        mattermost.send()

        text = """Wow you did overtime today :rocket:! Doing overtime from time to time can be good, but life after work is also important. Remember this next time taking 36.00 h in work :sunglasses:!
Average day. Not too few, not too many entries :sunglasses:.
It seems that more than 75% of your today work had redmine id! So .. you rock :rocket:!"""

        runner.send.assert_called_with(text)
Пример #3
0
    def test_append_summary_50_entries(self):
        runner = MagicMock()

        mattermost = MattermostNotifier(runner)

        e = TogglEntry(None, 60, self.today, 777, "#666 Hardwork",
                       self.redmine_config)
        l = []

        for i in range(50):
            l.append(e)

        mattermost._MattermostNotifier__append_summary(l)
        mattermost.send()

        text = """You worked almost less than 4 hours today (exactly 50 m), not every day is a perfect day, right? :smirk:.
You did 50 entries like a boss :smirk: :boom:!
It seems that more than 75% of your today work had redmine id! So .. you rock :rocket:!"""

        runner.send.assert_called_with(text)
Пример #4
0
    def test_append_summary_3_entries_1_redmine(self):
        runner = MagicMock()

        mattermost = MattermostNotifier(runner)

        l = [
            TogglEntry(None, 60, self.today, 777, "#666 Hardwork",
                       self.redmine_config),
            TogglEntry(None, 60, self.today, 777, "Hardwork",
                       self.redmine_config),
            TogglEntry(None, 60, self.today, 777, "Hardwork",
                       self.redmine_config),
        ]

        mattermost._MattermostNotifier__append_summary(l)
        mattermost.send()

        text = """You worked almost less than 4 hours today (exactly 3 m), not every day is a perfect day, right? :smirk:.
Huh, not many entries. It means, you did only a couple of tasks, but did it right .. right? :open_mouth:
Almost 50% of your today work had redmine id :blush:."""

        runner.send.assert_called_with(text)