Exemplo n.º 1
0
    def test_sanitizes_open_checksum_tag(self):
        """
        Assert that the function properly sanitizes the checksum type in the open checksum tag.
        """
        def mock_find(tag):
            checksum_element = mock.MagicMock()
            if tag == metadata.OPEN_CHECKSUM_TAG:
                checksum_element.attrib = {'type': 'sha'}
                checksum_element.text = 'checksum'
            return checksum_element

        data_element = mock.MagicMock()
        data_element.find.side_effect = mock_find

        file_info = metadata.process_repomd_data_element(data_element)

        self.assertEqual(file_info['open_checksum']['algorithm'], 'sha1')
Exemplo n.º 2
0
    def test_sanitizes_open_checksum_tag(self):
        """
        Assert that the function properly sanitizes the checksum type in the open checksum tag.
        """

        def mock_find(tag):
            checksum_element = mock.MagicMock()
            if tag == metadata.OPEN_CHECKSUM_TAG:
                checksum_element.attrib = {'type': 'sha'}
                checksum_element.text = 'checksum'
            return checksum_element

        data_element = mock.MagicMock()
        data_element.find.side_effect = mock_find

        file_info = metadata.process_repomd_data_element(data_element)

        self.assertEqual(file_info['open_checksum']['algorithm'], 'sha1')