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')
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")
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')
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)
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')
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')