forked from openlp/openlp
Typos & tests
This commit is contained in:
parent
28222ed0f8
commit
34f8cbc09b
@ -24,6 +24,7 @@ Package to test the openlp.core.__init__ package.
|
||||
"""
|
||||
from optparse import Values
|
||||
import os
|
||||
import sys
|
||||
|
||||
from unittest import TestCase
|
||||
from unittest.mock import MagicMock, patch
|
||||
@ -122,8 +123,23 @@ class TestInit(TestCase, TestMixin):
|
||||
options = ['-e', '-l', 'debug', '-pd', '-s', 'style', 'extra', 'qt', 'args']
|
||||
|
||||
# WHEN: Calling parse_options
|
||||
resluts = parse_options(options)
|
||||
results = parse_options(options)
|
||||
|
||||
# THEN: A tuple should be returned with the parsed options and left over args
|
||||
self.assertEqual(resluts, (Values({'no_error_form': True, 'dev_version': True, 'portable': True,
|
||||
self.assertEqual(results, (Values({'no_error_form': True, 'dev_version': True, 'portable': True,
|
||||
'style': 'style', 'loglevel': 'debug'}), ['extra', 'qt', 'args']))
|
||||
|
||||
def parse_options_valid_argv_short_options_test(self):
|
||||
"""
|
||||
Test that parse_options parses valid short options correctly when passed through sys.argv
|
||||
"""
|
||||
# GIVEN: A list of valid options
|
||||
options = ['-e', '-l', 'debug', '-pd', '-s', 'style', 'extra', 'qt', 'args']
|
||||
|
||||
# WHEN: Passing in the options through sys.argv and calling parse_args with None
|
||||
with patch.object(sys, 'argv', options):
|
||||
results = parse_options(None)
|
||||
|
||||
# THEN: parse_args should return a tuple of valid options and of left over options that OpenLP does not use
|
||||
self.assertEqual(results, (Values({'no_error_form': True, 'dev_version': True, 'portable': True,
|
||||
'style': 'style', 'loglevel': 'debug'}), ['extra', 'qt', 'args']))
|
||||
|
Loading…
Reference in New Issue
Block a user