diff --git a/tests/abstract_attract_test.py b/tests/abstract_attract_test.py index baf1f4a..e3f6d13 100644 --- a/tests/abstract_attract_test.py +++ b/tests/abstract_attract_test.py @@ -22,6 +22,10 @@ class AbstractAttractTest(AbstractPillarTest): AbstractPillarTest.tearDown(self) + @property + def attract(self): + return self.app.pillar_extensions['attract'] + def ensure_project_exists(self, project_overrides=None): from attract.setup import setup_for_attract diff --git a/tests/test_shortcode.py b/tests/test_shortcode.py index b1fc848..244f128 100644 --- a/tests/test_shortcode.py +++ b/tests/test_shortcode.py @@ -25,7 +25,7 @@ class ShortcodeTest(AbstractAttractTest): def setUp(self, **kwargs): AbstractAttractTest.setUp(self, **kwargs) - self.mngr = self.app.pillar_extensions['attract'].task_manager + self.mngr = self.attract.task_manager self.proj_id, self.project = self.ensure_project_exists() def test_increment_simple(self): diff --git a/tests/test_shots.py b/tests/test_shots.py index e8efc51..5d75126 100644 --- a/tests/test_shots.py +++ b/tests/test_shots.py @@ -18,8 +18,8 @@ class AbstractShotTest(AbstractAttractTest): def setUp(self, **kwargs): AbstractAttractTest.setUp(self, **kwargs) - self.tmngr = self.app.pillar_extensions['attract'].task_manager - self.smngr = self.app.pillar_extensions['attract'].shot_manager + self.tmngr = self.attract.task_manager + self.smngr = self.attract.shot_manager self.proj_id, self.project = self.ensure_project_exists() @@ -190,7 +190,7 @@ class PatchShotTest(AbstractShotTest): self.patch(url, json=patch, auth_token='token') with self.app.test_request_context(): - acts = self.app.pillar_extensions['attract'].activities_for_node(shot._id) + acts = self.attract.activities_for_node(shot._id) self.assertEqual(2, acts['_meta']['total']) # Creation + edit edit_act = acts['_items'][1] self.assertIn(old_name, edit_act['verb']) diff --git a/tests/test_subversion.py b/tests/test_subversion.py index 1d2de0b..dfb6e13 100644 --- a/tests/test_subversion.py +++ b/tests/test_subversion.py @@ -202,7 +202,7 @@ class PushCommitTest(AbstractAttractTest): def setUp(self, **kwargs): AbstractAttractTest.setUp(self, **kwargs) - self.mngr = self.app.pillar_extensions['attract'].task_manager + self.mngr = self.attract.task_manager self.proj_id, self.project = self.ensure_project_exists() def test_push_happy(self): diff --git a/tests/test_tasks.py b/tests/test_tasks.py index 1f2bd77..bca942e 100644 --- a/tests/test_tasks.py +++ b/tests/test_tasks.py @@ -18,7 +18,7 @@ class TaskWorkflowTest(AbstractAttractTest): def setUp(self, **kwargs): AbstractAttractTest.setUp(self, **kwargs) - self.mngr = self.app.pillar_extensions['attract'].task_manager + self.mngr = self.attract.task_manager self.proj_id, self.project = self.ensure_project_exists() self.sdk_project = pillarsdk.Project(pillar.tests.mongo_to_sdk(self.project)) @@ -106,7 +106,7 @@ class TaskWorkflowTest(AbstractAttractTest): _etag=task._etag) with self.app.test_request_context(): - acts = self.app.pillar_extensions['attract'].activities_for_node(task['_id']) + acts = self.attract.activities_for_node(task['_id']) self.assertEqual(2, acts['_meta']['total']) # Creation + edit edit_act = acts['_items'][1]