Exemplo n.º 1
0
 def test_format_unmarked(self, mock_arrow):
     mock_arrow.return_value.humanize.return_value = '2 months ago'
     expected_message = (
         u'koschei\'s scratch build of eclipse-4.5.0-1.fc26.src.rpm for f26 started 2 months'
         u' ago http://koji.fedoraproject.org/koji/taskinfo?taskID=16289846'
     )
     formatted_message = formatters.irc(self.message, self.recipient)
     self.assertEqual(expected_message, formatted_message)
Exemplo n.º 2
0
    def test_format_triggered_by(self, mock_arrow):
        """Assert triggered-by links are added to IRC messages if configured to."""
        mock_arrow.return_value.humanize.return_value = 'eleventy-one minutes ago'
        self.recipient['triggered_by_links'] = True
        expected_message = (
            u"koschei's scratch build of eclipse-4.5.0-1.fc26.src.rpm for f26 started "
            u"eleventy-one minutes ago http://koji.fedoraproject.org/koji/taskinfo?taskID=16289846"
            u" (triggered by http://localhost:5000/jcline.id.fedoraproject.org/irc/7)"
        )

        formatted_message = formatters.irc(self.message, self.recipient)
        self.assertEqual(expected_message, formatted_message)
Exemplo n.º 3
0
    def test_format_marked_up(self, mock_arrow):
        """Assert pretty colors are added to IRC messages if marked up."""
        mock_arrow.return_value.humanize.return_value = '2 score and 3 days ago'
        self.recipient['markup_messages'] = True
        expected_message = (
            u"\x038buildsys.task.state.change\x03 -- koschei's scratch build of "
            u"eclipse-4.5.0-1.fc26.src.rpm for f26 started 2 score and 3 days ago"
            u" \x0310http://koji.fedoraproject.org/koji/taskinfo?taskID=16289846\x03"
        )

        formatted_message = formatters.irc(self.message, self.recipient)
        self.assertEqual(expected_message, formatted_message)
Exemplo n.º 4
0
    def test_shorten(self, mock_arrow):
        """Assert links are shortened."""
        mock_arrow.return_value.humanize.return_value = 'Schfourteenteen hours ago'
        self.recipient['shorten_links'] = True
        self.recipient['triggered_by_links'] = True

        expected_message = (
            u'koschei\'s scratch build of eclipse-4.5.0-1.fc26.src.rpm for f26 started '
            u'Schfourteenteen hours ago https://da.gd/TT0da (triggered by https://da.gd/B800F)'
        )

        formatted_message = formatters.irc(self.message, self.recipient)
        self.assertEqual(expected_message, formatted_message)