Unit test refactor
- redundant imports in test modules were removed - reset color code management in test simplified Signed-off-by: Jiri Podivin <jpodivin@redhat.com> Change-Id: Iac5e68286782c5c2fbc185650c0bdf915fe959ef
This commit is contained in:
parent
e4b5dc3ea7
commit
07558871d6
@ -13,10 +13,6 @@
|
||||
# under the License.
|
||||
#
|
||||
|
||||
try:
|
||||
from unittest import mock
|
||||
except ImportError:
|
||||
import mock
|
||||
from unittest import TestCase
|
||||
|
||||
from validations_libs.cli import app
|
||||
|
@ -26,8 +26,8 @@ class TestColors(TestCase):
|
||||
RED = "\033[1;31m"
|
||||
GREEN = "\033[0;32m"
|
||||
CYAN = "\033[36m"
|
||||
RESET = "\033[0;0m"
|
||||
YELLOW = "\033[0;33m"
|
||||
self.RESET = "\033[0;0m"
|
||||
|
||||
self.status_color = {
|
||||
'starting': CYAN,
|
||||
@ -50,7 +50,7 @@ class TestColors(TestCase):
|
||||
color = self.status_color[status]
|
||||
colored_output = colors.color_output("fizz", status=status)
|
||||
#Checking reset color
|
||||
self.assertEqual(colored_output[-6:], '\033[0;0m')
|
||||
self.assertEqual(colored_output[-6:], self.RESET)
|
||||
#Checking output color
|
||||
self.assertEqual(colored_output[:len(color)], color)
|
||||
#Checking output string
|
||||
@ -61,7 +61,7 @@ class TestColors(TestCase):
|
||||
color = self.status_color['UNKNOWN']
|
||||
colored_output = colors.color_output("buzz")
|
||||
#Checking reset color
|
||||
self.assertEqual(colored_output[-6:], '\033[0;0m')
|
||||
self.assertEqual(colored_output[-6:], self.RESET)
|
||||
#Checking output color
|
||||
self.assertEqual(colored_output[:len(color)], color)
|
||||
#Checking output string
|
||||
|
@ -16,7 +16,6 @@ try:
|
||||
from unittest import mock
|
||||
except ImportError:
|
||||
import mock
|
||||
from unittest import TestCase
|
||||
|
||||
from validations_libs.cli import history
|
||||
from validations_libs.tests import fakes
|
||||
|
@ -16,7 +16,6 @@ try:
|
||||
from unittest import mock
|
||||
except ImportError:
|
||||
import mock
|
||||
from unittest import TestCase
|
||||
|
||||
from validations_libs.cli import lister
|
||||
from validations_libs.tests import fakes
|
||||
|
@ -18,7 +18,6 @@ try:
|
||||
from unittest import mock
|
||||
except ImportError:
|
||||
import mock
|
||||
from unittest import TestCase
|
||||
|
||||
from validations_libs.cli import run
|
||||
from validations_libs.tests import fakes
|
||||
|
@ -16,7 +16,6 @@ try:
|
||||
from unittest import mock
|
||||
except ImportError:
|
||||
import mock
|
||||
from unittest import TestCase
|
||||
|
||||
from validations_libs.cli import show
|
||||
from validations_libs.tests import fakes
|
||||
|
Loading…
x
Reference in New Issue
Block a user