def test_set_record_struct(self): """ Test the :mod:`set_record_struct` module """ # GIVEN: A mocked out SongImport class, a mocked out struct class, and a mocked out "manager" and a list of # field descriptions with patch('openlp.plugins.songs.lib.importers.easyworship.SongImport'), \ patch('openlp.plugins.songs.lib.importers.easyworship.struct') as mocked_struct: mocked_manager = MagicMock() importer = EasyWorshipSongImport(mocked_manager, filenames=[]) # WHEN: set_record_struct is called with a list of field descriptions return_value = importer.set_record_struct(TEST_FIELD_DESCS) # THEN: set_record_struct should return None and Struct should be called with a value representing # the list of field descriptions self.assertIsNone(return_value, 'set_record_struct should return None') mocked_struct.Struct.assert_called_with('>50sHIB250s250s10sQ')
def set_record_struct_test(self): """ Test the :mod:`set_record_struct` module """ # GIVEN: A mocked out SongImport class, a mocked out struct class, and a mocked out "manager" and a list of # field descriptions with patch('openlp.plugins.songs.lib.importers.easyworship.SongImport'), \ patch('openlp.plugins.songs.lib.importers.easyworship.struct') as mocked_struct: mocked_manager = MagicMock() importer = EasyWorshipSongImport(mocked_manager, filenames=[]) # WHEN: set_record_struct is called with a list of field descriptions return_value = importer.set_record_struct(TEST_FIELD_DESCS) # THEN: set_record_struct should return None and Struct should be called with a value representing # the list of field descriptions self.assertIsNone(return_value, 'set_record_struct should return None') mocked_struct.Struct.assert_called_with('>50sHIB250s250s10sQ')