fix tests

This commit is contained in:
Tim Bentley 2016-03-31 17:24:44 +01:00
parent 3693cf331d
commit 946d9ee3d5
2 changed files with 7 additions and 19 deletions

View File

@ -37,7 +37,7 @@ class TestInitFunctions(TestMixin, TestCase):
# GIVEN: a a set of system arguments. # GIVEN: a a set of system arguments.
sys.argv[1:] = [] sys.argv[1:] = []
# WHEN: We we parse them to expand to options # WHEN: We we parse them to expand to options
args = parse_options() args = parse_options(None)
# THEN: the following fields will have been extracted. # THEN: the following fields will have been extracted.
self.assertFalse(args.dev_version, 'The dev_version flag should be False') self.assertFalse(args.dev_version, 'The dev_version flag should be False')
self.assertEquals(args.loglevel, 'warning', 'The log level should be set to warning') self.assertEquals(args.loglevel, 'warning', 'The log level should be set to warning')
@ -54,7 +54,7 @@ class TestInitFunctions(TestMixin, TestCase):
# GIVEN: a a set of system arguments. # GIVEN: a a set of system arguments.
sys.argv[1:] = ['-l debug'] sys.argv[1:] = ['-l debug']
# WHEN: We we parse them to expand to options # WHEN: We we parse them to expand to options
args = parse_options() args = parse_options(None)
# THEN: the following fields will have been extracted. # THEN: the following fields will have been extracted.
self.assertFalse(args.dev_version, 'The dev_version flag should be False') self.assertFalse(args.dev_version, 'The dev_version flag should be False')
self.assertEquals(args.loglevel, ' debug', 'The log level should be set to debug') self.assertEquals(args.loglevel, ' debug', 'The log level should be set to debug')
@ -71,7 +71,7 @@ class TestInitFunctions(TestMixin, TestCase):
# GIVEN: a a set of system arguments. # GIVEN: a a set of system arguments.
sys.argv[1:] = ['--portable'] sys.argv[1:] = ['--portable']
# WHEN: We we parse them to expand to options # WHEN: We we parse them to expand to options
args = parse_options() args = parse_options(None)
# THEN: the following fields will have been extracted. # THEN: the following fields will have been extracted.
self.assertFalse(args.dev_version, 'The dev_version flag should be False') self.assertFalse(args.dev_version, 'The dev_version flag should be False')
self.assertEquals(args.loglevel, 'warning', 'The log level should be set to warning') self.assertEquals(args.loglevel, 'warning', 'The log level should be set to warning')
@ -88,7 +88,7 @@ class TestInitFunctions(TestMixin, TestCase):
# GIVEN: a a set of system arguments. # GIVEN: a a set of system arguments.
sys.argv[1:] = ['-l debug', '-d'] sys.argv[1:] = ['-l debug', '-d']
# WHEN: We we parse them to expand to options # WHEN: We we parse them to expand to options
args = parse_options() args = parse_options(None)
# THEN: the following fields will have been extracted. # THEN: the following fields will have been extracted.
self.assertTrue(args.dev_version, 'The dev_version flag should be True') self.assertTrue(args.dev_version, 'The dev_version flag should be True')
self.assertEquals(args.loglevel, ' debug', 'The log level should be set to debug') self.assertEquals(args.loglevel, ' debug', 'The log level should be set to debug')
@ -105,7 +105,7 @@ class TestInitFunctions(TestMixin, TestCase):
# GIVEN: a a set of system arguments. # GIVEN: a a set of system arguments.
sys.argv[1:] = ['dummy_temp'] sys.argv[1:] = ['dummy_temp']
# WHEN: We we parse them to expand to options # WHEN: We we parse them to expand to options
args = parse_options() args = parse_options(None)
# THEN: the following fields will have been extracted. # THEN: the following fields will have been extracted.
self.assertFalse(args.dev_version, 'The dev_version flag should be False') self.assertFalse(args.dev_version, 'The dev_version flag should be False')
self.assertEquals(args.loglevel, 'warning', 'The log level should be set to warning') self.assertEquals(args.loglevel, 'warning', 'The log level should be set to warning')
@ -122,7 +122,7 @@ class TestInitFunctions(TestMixin, TestCase):
# GIVEN: a a set of system arguments. # GIVEN: a a set of system arguments.
sys.argv[1:] = ['-l debug', 'dummy_temp'] sys.argv[1:] = ['-l debug', 'dummy_temp']
# WHEN: We we parse them to expand to options # WHEN: We we parse them to expand to options
args = parse_options() args = parse_options(None)
# THEN: the following fields will have been extracted. # THEN: the following fields will have been extracted.
self.assertFalse(args.dev_version, 'The dev_version flag should be False') self.assertFalse(args.dev_version, 'The dev_version flag should be False')
self.assertEquals(args.loglevel, ' debug', 'The log level should be set to debug') self.assertEquals(args.loglevel, ' debug', 'The log level should be set to debug')
@ -130,15 +130,3 @@ class TestInitFunctions(TestMixin, TestCase):
self.assertFalse(args.portable, 'The portable flag should be set to false') self.assertFalse(args.portable, 'The portable flag should be set to false')
self.assertEquals(args.style, None, 'There are no style flags to be processed') self.assertEquals(args.style, None, 'There are no style flags to be processed')
self.assertEquals(args.rargs, 'dummy_temp', 'The service file should not be blank') self.assertEquals(args.rargs, 'dummy_temp', 'The service file should not be blank')
def parse_options_two_files_test(self):
"""
Test the parse options process works with a file
"""
# GIVEN: a a set of system arguments.
sys.argv[1:] = ['dummy_temp', 'dummy_temp2']
# WHEN: We we parse them to expand to options
args = parse_options()
# THEN: the following fields will have been extracted.
self.assertEquals(args, None, 'The args should be None')

View File

@ -20,7 +20,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
""" """
Package to test the openlp.core.utils.db package. Package to test the openlp.core.common.db package.
""" """
import gc import gc
import os import os