home
·
contact
·
privacy
projects
/
plomtask
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Refactor remaining test.utils helpers into actual tests.
[plomtask]
/
tests
/
processes.py
diff --git
a/tests/processes.py
b/tests/processes.py
index d33aa8fd5c1fa2bd28a2b53a8440c9aed43bda6f..481d2d4a691ab586035a05a6b938a33e0f48d612 100644
(file)
--- a/
tests/processes.py
+++ b/
tests/processes.py
@@
-65,11
+65,8
@@
class TestsWithDB(TestCaseWithDB):
self.assertEqual(sorted(r.disables), sorted(set3))
def test_from_table_row(self) -> None:
self.assertEqual(sorted(r.disables), sorted(set3))
def test_from_table_row(self) -> None:
- """Test .from_table_row() properly reads in class from DB"""
+ """Test .from_table_row() properly reads in class from DB
.
"""
super().test_from_table_row()
super().test_from_table_row()
- self.check_versioned_from_table_row('title', str)
- self.check_versioned_from_table_row('description', str)
- self.check_versioned_from_table_row('effort', float)
p, set1, set2, set3 = self.p_of_conditions()
p.save(self.db_conn)
assert isinstance(p.id_, int)
p, set1, set2, set3 = self.p_of_conditions()
p.save(self.db_conn)
assert isinstance(p.id_, int)
@@
-183,13
+180,9
@@
class TestsWithDB(TestCaseWithDB):
method(self.db_conn, [c1.id_, c2.id_])
self.assertEqual(getattr(p, target), [c1, c2])
method(self.db_conn, [c1.id_, c2.id_])
self.assertEqual(getattr(p, target), [c1, c2])
- def test_Process_versioned_attributes_singularity(self) -> None:
- """Test behavior of VersionedAttributes on saving (with .title)."""
- self.check_versioned_singularity()
-
- def test_Process_removal(self) -> None:
+ def test_remove(self) -> None:
"""Test removal of Processes and ProcessSteps."""
"""Test removal of Processes and ProcessSteps."""
- s
elf.check
_remove()
+ s
uper().test
_remove()
p1, p2, p3 = self.three_processes()
assert isinstance(p1.id_, int)
assert isinstance(p2.id_, int)
p1, p2, p3 = self.three_processes()
assert isinstance(p1.id_, int)
assert isinstance(p2.id_, int)
@@
-222,28
+215,24
@@
class TestsWithDB(TestCaseWithDB):
class TestsWithDBForProcessStep(TestCaseWithDB):
"""Module tests requiring DB setup."""
checked_class = ProcessStep
class TestsWithDBForProcessStep(TestCaseWithDB):
"""Module tests requiring DB setup."""
checked_class = ProcessStep
- default_init_kwargs = {'owner_id':
2, 'step_process_id': 3
,
- 'parent_step_id':
4
}
+ default_init_kwargs = {'owner_id':
1, 'step_process_id': 2
,
+ 'parent_step_id':
3
}
def setUp(self) -> None:
super().setUp()
def setUp(self) -> None:
super().setUp()
- p = Process(1)
- p.save(self.db_conn)
- p = Process(2)
- p.save(self.db_conn)
+ self.p1 = Process(1)
+ self.p1.save(self.db_conn)
- def test_
ProcessStep_
remove(self) -> None:
+ def test_remove(self) -> None:
"""Test .remove and unsetting of owner's .explicit_steps entry."""
"""Test .remove and unsetting of owner's .explicit_steps entry."""
- p1 = Process(None)
- p2 = Process(None)
- p1.save(self.db_conn)
+ p2 = Process(2)
p2.save(self.db_conn)
p2.save(self.db_conn)
- assert isinstance(p1.id_, int)
+ assert isinstance(
self.
p1.id_, int)
assert isinstance(p2.id_, int)
assert isinstance(p2.id_, int)
- step = ProcessStep(None, p1.id_, p2.id_, None)
- p1.set_steps(self.db_conn, [step])
+ step = ProcessStep(None,
self.
p1.id_, p2.id_, None)
+
self.
p1.set_steps(self.db_conn, [step])
step.remove(self.db_conn)
step.remove(self.db_conn)
- self.assertEqual(p1.explicit_steps, [])
+ self.assertEqual(
self.
p1.explicit_steps, [])
self.check_identity_with_cache_and_db([])
self.check_identity_with_cache_and_db([])