Improved tests #129
This commit is contained in:
@@ -1,18 +1,16 @@
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import unittest
|
||||
|
||||
from cpl_core.utils import String
|
||||
|
||||
from unittests_cli.abc.command_test_case import CommandTestCase
|
||||
from unittests_cli.constants import PLAYGROUND_PATH
|
||||
from unittests_shared.cli_commands import CLICommands
|
||||
|
||||
|
||||
class AddTestCase(unittest.TestCase):
|
||||
class AddTestCase(CommandTestCase):
|
||||
|
||||
def __init__(self, methodName: str):
|
||||
unittest.TestCase.__init__(self, methodName)
|
||||
def __init__(self, method_name: str):
|
||||
CommandTestCase.__init__(self, method_name)
|
||||
self._source = 'add-test-project'
|
||||
self._target = 'add-test-library'
|
||||
self._project_file = f'src/{String.convert_to_snake_case(self._source)}/{self._source}.json'
|
||||
@@ -26,22 +24,12 @@ class AddTestCase(unittest.TestCase):
|
||||
return project_json
|
||||
|
||||
def setUp(self):
|
||||
if not os.path.exists(PLAYGROUND_PATH):
|
||||
os.makedirs(PLAYGROUND_PATH)
|
||||
|
||||
os.chdir(PLAYGROUND_PATH)
|
||||
# create projects
|
||||
CLICommands.new('console', self._source, '--ab', '--s')
|
||||
os.chdir(os.path.join(os.getcwd(), self._source))
|
||||
CLICommands.new('console', self._target, '--ab', '--s')
|
||||
|
||||
def cleanUp(self):
|
||||
# remove projects
|
||||
if not os.path.exists(os.path.abspath(os.path.join(PLAYGROUND_PATH, self._source))):
|
||||
return
|
||||
|
||||
shutil.rmtree(os.path.abspath(os.path.join(PLAYGROUND_PATH, self._source)))
|
||||
|
||||
def test_add(self):
|
||||
CLICommands.add(self._source, self._target)
|
||||
settings = self._get_project_settings()
|
||||
|
||||
Reference in New Issue
Block a user