Tests: common/reusable variables live in basetest.utils
This commit is contained in:
@@ -33,7 +33,7 @@ import unittest
|
|||||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|
||||||
from basetest import Task, TestCase
|
from basetest import Task, TestCase
|
||||||
from basetest.utils import UUID_regex
|
from basetest.utils import UUID_REGEXP
|
||||||
|
|
||||||
|
|
||||||
class TestAdd(TestCase):
|
class TestAdd(TestCase):
|
||||||
@@ -49,7 +49,7 @@ class TestAdd(TestCase):
|
|||||||
self.assertRegexpMatches(out, "ID\s+1\n")
|
self.assertRegexpMatches(out, "ID\s+1\n")
|
||||||
self.assertRegexpMatches(out, "Description\s+This is a test\n")
|
self.assertRegexpMatches(out, "Description\s+This is a test\n")
|
||||||
self.assertRegexpMatches(out, "Status\s+Pending\n")
|
self.assertRegexpMatches(out, "Status\s+Pending\n")
|
||||||
self.assertRegexpMatches(out, "UUID\s+" + UUID_regex + "\n")
|
self.assertRegexpMatches(out, "UUID\s+" + UUID_REGEXP + "\n")
|
||||||
|
|
||||||
def test_modify_slash(self):
|
def test_modify_slash(self):
|
||||||
"Test the /// modifier"
|
"Test the /// modifier"
|
||||||
@@ -62,7 +62,7 @@ class TestAdd(TestCase):
|
|||||||
self.assertRegexpMatches(out, "ID\s+1\n")
|
self.assertRegexpMatches(out, "ID\s+1\n")
|
||||||
self.assertRegexpMatches(out, "Status\s+Pending\n")
|
self.assertRegexpMatches(out, "Status\s+Pending\n")
|
||||||
self.assertRegexpMatches(out, "Description\s+This a TEST\n")
|
self.assertRegexpMatches(out, "Description\s+This a TEST\n")
|
||||||
self.assertRegexpMatches(out, "UUID\s+" + UUID_regex + "\n")
|
self.assertRegexpMatches(out, "UUID\s+" + UUID_REGEXP + "\n")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ TASKD_SKIP = os.environ.get("TASKD_SKIP", False)
|
|||||||
TASK_USE_PATH = os.environ.get("TASK_USE_PATH", False)
|
TASK_USE_PATH = os.environ.get("TASK_USE_PATH", False)
|
||||||
TASKD_USE_PATH = os.environ.get("TASKD_USE_PATH", False)
|
TASKD_USE_PATH = os.environ.get("TASKD_USE_PATH", False)
|
||||||
|
|
||||||
UUID_regex = ("[0-9A-Fa-f]{8}-" + ("[0-9A-Fa-f]{4}-" * 3) + "[0-9A-Fa-f]{12}")
|
UUID_REGEXP = ("[0-9A-Fa-f]{8}-" + ("[0-9A-Fa-f]{4}-" * 3) + "[0-9A-Fa-f]{12}")
|
||||||
|
|
||||||
|
|
||||||
def task_binary_location(cmd="task"):
|
def task_binary_location(cmd="task"):
|
||||||
|
|||||||
@@ -39,9 +39,8 @@ import unittest
|
|||||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|
||||||
from basetest import Task, TestCase
|
from basetest import Task, TestCase
|
||||||
|
from basetest.utils import UUID_REGEXP
|
||||||
|
|
||||||
# TODO: Move to common file with all regexpes
|
|
||||||
UUID_REGEXP = r'[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}'
|
|
||||||
DATETIME_FORMAT = "%Y%m%dT%H%M%SZ"
|
DATETIME_FORMAT = "%Y%m%dT%H%M%SZ"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user