コード例 #1
0
    def test_add_unit_metadata(self):
        context = FilelistsXMLFileContext(self.working_dir, 3)
        context.metadata_file_handle = mock.Mock()

        context.add_unit_metadata(mock.Mock(repodata={'filelists': 'bar'}))

        context.metadata_file_handle.write.assert_called_once_with('bar')
コード例 #2
0
ファイル: test_filelists.py プロジェクト: asmacdo/pulp_rpm
    def test_add_unit_metadata(self):
        context = FilelistsXMLFileContext(self.working_dir, 3)
        context.metadata_file_handle = mock.Mock()

        context.add_unit_metadata(mock.Mock(metadata={"repodata": {"filelists": "bar"}}))

        context.metadata_file_handle.write.assert_called_once_with("bar")
コード例 #3
0
ファイル: test_filelists.py プロジェクト: ATIX-AG/pulp_rpm
    def test_add_unit_metadata(self):
        context = FilelistsXMLFileContext(self.working_dir, 3, 'sha256')
        context.metadata_file_handle = mock.Mock()

        context.add_unit_metadata(self.unit)

        context.metadata_file_handle.write.assert_called_once_with('somexml')
        self.unit.render_filelists.assert_called_once_with('sha256')
コード例 #4
0
ファイル: test_filelists.py プロジェクト: ulif/pulp_rpm
    def test_add_unit_metadata(self):
        context = FilelistsXMLFileContext(self.working_dir, 3, 'sha256')
        context.metadata_file_handle = mock.Mock()

        context.add_unit_metadata(self.unit)

        context.metadata_file_handle.write.assert_called_once_with('somexml')
        self.unit.render_filelists.assert_called_once_with('sha256')
コード例 #5
0
    def test_add_unit_metadata_unicode(self):
        """
        Test that the filelists repodata is passed as a str even if it's a unicode object.
        """
        context = FilelistsXMLFileContext(self.working_dir, 3)
        context.metadata_file_handle = mock.Mock()
        expected_call = 'some unicode'
        repodata = {'filelists': unicode(expected_call)}

        context.add_unit_metadata(mock.Mock(repodata=repodata))
        context.metadata_file_handle.write.assert_called_once_with(expected_call)
コード例 #6
0
ファイル: test_filelists.py プロジェクト: ATIX-AG/pulp_rpm
    def test_add_unit_metadata_unicode(self):
        """
        Test that the filelists repodata is passed as a str even if it's a unicode object.
        """
        context = FilelistsXMLFileContext(self.working_dir, 3, 'sha256')
        context.metadata_file_handle = mock.Mock()
        expected_call = u'some unicode'
        self.unit.render_filelists.return_value = expected_call

        context.add_unit_metadata(self.unit)
        context.metadata_file_handle.write.assert_called_once_with(expected_call)
        self.unit.render_filelists.assert_called_once_with('sha256')
コード例 #7
0
ファイル: test_filelists.py プロジェクト: ulif/pulp_rpm
    def test_add_unit_metadata_unicode(self):
        """
        Test that the filelists repodata is passed as a str even if it's a unicode object.
        """
        context = FilelistsXMLFileContext(self.working_dir, 3, 'sha256')
        context.metadata_file_handle = mock.Mock()
        expected_call = u'some unicode'
        self.unit.render_filelists.return_value = expected_call

        context.add_unit_metadata(self.unit)
        context.metadata_file_handle.write.assert_called_once_with(
            expected_call)
        self.unit.render_filelists.assert_called_once_with('sha256')