~tomasgroth/openlp/portable-path

« back to all changes in this revision

Viewing changes to tests/functional/openlp_plugins/songs/test_openlpimporter.py

  • Committer: Tomas Groth
  • Date: 2019-04-30 19:02:42 UTC
  • mfrom: (2829.2.32 openlp)
  • Revision ID: tomasgroth@yahoo.dk-20190430190242-6zwjk8724tyux70m
trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
###############################################################################
5
5
# OpenLP - Open Source Lyrics Projection                                      #
6
6
# --------------------------------------------------------------------------- #
7
 
# Copyright (c) 2008-2018 OpenLP Developers                                   #
 
7
# Copyright (c) 2008-2019 OpenLP Developers                                   #
8
8
# --------------------------------------------------------------------------- #
9
9
# This program is free software; you can redistribute it and/or modify it     #
10
10
# under the terms of the GNU General Public License as published by the Free  #
22
22
"""
23
23
This module contains tests for the OpenLP song importer.
24
24
"""
 
25
from pathlib import Path
25
26
from unittest import TestCase
26
 
from unittest.mock import patch, MagicMock
 
27
from unittest.mock import MagicMock, patch
27
28
 
28
29
from openlp.core.common.registry import Registry
29
30
from openlp.plugins.songs.lib.importers.openlp import OpenLPSongImport
66
67
            importer.stop_import_flag = True
67
68
 
68
69
            # WHEN: Import source is not a list
69
 
            for source in ['not a list', 0]:
70
 
                importer.import_source = source
 
70
            importer.import_source = Path()
71
71
 
72
 
                # THEN: do_import should return none and the progress bar maximum should not be set.
73
 
                assert importer.do_import() is None, 'do_import should return None when import_source is not a list'
74
 
                assert mocked_import_wizard.progress_bar.setMaximum.called is False, \
75
 
                    'setMaximum on import_wizard.progress_bar should not have been called'
 
72
            # THEN: do_import should return none and the progress bar maximum should not be set.
 
73
            assert importer.do_import() is None, 'do_import should return None when import_source is not a list'
 
74
            assert mocked_import_wizard.progress_bar.setMaximum.called is False, \
 
75
                'setMaximum on import_wizard.progress_bar should not have been called'