コード例 #1
0
    def test_find_field_exists(self):
        """
        Test finding an existing field in a given list using the :mod:`find_field`
        """
        # GIVEN: A mocked out SongImport class, a mocked out "manager" and a list of field descriptions.
        with patch('openlp.plugins.songs.lib.importers.easyworship.SongImport'):
            mocked_manager = MagicMock()
            importer = EasyWorshipSongImport(mocked_manager, filenames=[])
            importer.field_descriptions = TEST_FIELD_DESCS

            # WHEN: Called with a field name that exists
            existing_fields = ['Title', 'Text Percentage Bottom', 'RecID', 'Default Background', 'Words',
                               'BK Bitmap', 'Last Modified']
            for field_name in existing_fields:

                # THEN: The item corresponding the index returned should have the same name attribute
                self.assertEqual(importer.field_descriptions[importer.find_field(field_name)].name, field_name)
コード例 #2
0
ファイル: test_ewimport.py プロジェクト: crossroadchurch/paul
    def find_field_exists_test(self):
        """
        Test finding an existing field in a given list using the :mod:`find_field`
        """
        # GIVEN: A mocked out SongImport class, a mocked out "manager" and a list of field descriptions.
        with patch('openlp.plugins.songs.lib.importers.easyworship.SongImport'):
            mocked_manager = MagicMock()
            importer = EasyWorshipSongImport(mocked_manager, filenames=[])
            importer.field_descriptions = TEST_FIELD_DESCS

            # WHEN: Called with a field name that exists
            existing_fields = ['Title', 'Text Percentage Bottom', 'RecID', 'Default Background', 'Words',
                               'BK Bitmap', 'Last Modified']
            for field_name in existing_fields:

                # THEN: The item corresponding the index returned should have the same name attribute
                self.assertEqual(importer.field_descriptions[importer.find_field(field_name)].name, field_name)