def test_given_tag_with_no_information_then_error(self, _1):
        expected_error_message = "Can't find tag info"

        tag = MagicMock()

        del tag.object.author  # Make sure hasattr(mock, author) fails
        del tag.object.object.author

        tag_list = [tag]
        log_info = {u'commit_objects': {}, u'max_author_length': 0, u'logs': []}

        try:
            dls_logs_since_release.get_tag_messages(tag_list, log_info)
        except ValueError as error:
            self.assertEqual(str(error), expected_error_message)
Ejemplo n.º 2
0
    def test_given_tag_with_no_information_then_error(self, _1):
        expected_error_message = "Can't find tag info"

        tag = MagicMock()

        del tag.object.author  # Make sure hasattr(mock, author) fails
        del tag.object.object.author

        tag_list = [tag]
        log_info = {
            u'commit_objects': {},
            u'max_author_length': 0,
            u'logs': []
        }

        try:
            dls_logs_since_release.get_tag_messages(tag_list, log_info)
        except ValueError as error:
            self.assertEqual(str(error), expected_error_message)
    def test_extracts_lightweight_tag_information(self, _1):
        self.maxDiff = None

        tag = MagicMock()
        commit = tag.commit
        tag.name = '4-1'
        tag.object.committed_date = 1407847810
        tag.object.hexsha = 'e327e92'
        tag.object.author.name = 'Ronaldo Mercado'
        tag.object.summary = 'add on_sdo_message to process scanner MSG_SDO_READ messages'
        tag.object.message = 'add on_sdo_message to process scanner MSG_SDO_READ messages ' \
                             'make "sdos" public to allow checks on the sdo_observers list'
        tag_list = [tag]

        log_info = {u'commit_objects': {}, u'max_author_length': 0, u'logs': []}
        log_info = dls_logs_since_release.get_tag_messages(tag_list, log_info)

        self.assertEqual(log_info, {u'commit_objects': {'e327e92': commit}, u'max_author_length': 15,
                                    u'logs': [[1407847810, 'e327e92', 'Ronaldo Mercado',
                                               u'add on_sdo_message to process ' u'scanner MSG_SDO_READ messages (RELEASE: 4-1)',
                                               u'12/08/2014 13:50:10',
                                               u' make "sdos" public to allow checks on the sdo_observers list']]})
Ejemplo n.º 4
0
    def test_extracts_annotated_tag_information(self, _1):
        self.maxDiff = None

        tag = MagicMock()
        del tag.object.author  # Make sure hasattr(mock, author) fails

        commit = tag.commit
        tag.name = '4-1'
        tag.object.object.committed_date = 1407847810
        tag.object.hexsha = 'e327e92'
        tag.object.object.author.name = 'Ronaldo Mercado'
        tag.object.object.summary = 'add on_sdo_message to process scanner MSG_SDO_READ messages'
        tag.object.object.message = 'add on_sdo_message to process scanner MSG_SDO_READ messages ' \
                                    'make "sdos" public to allow checks on the sdo_observers list'
        tag_list = [tag]

        log_info = {
            u'commit_objects': {},
            u'max_author_length': 0,
            u'logs': []
        }
        log_info = dls_logs_since_release.get_tag_messages(tag_list, log_info)

        self.assertEqual(
            log_info, {
                u'commit_objects': {
                    'e327e92': commit
                },
                u'max_author_length':
                15,
                u'logs': [[
                    1407847810, 'e327e92', 'Ronaldo Mercado',
                    u'add on_sdo_message to process '
                    u'scanner MSG_SDO_READ messages (RELEASE: 4-1)',
                    u'12/08/2014 13:50:10',
                    u' make "sdos" public to allow checks on the sdo_observers list'
                ]]
            })