From 18d690669f6131bcf30577091078a219a0cda88f Mon Sep 17 00:00:00 2001 From: Johannes Ernst Date: Fri, 20 Sep 2024 16:27:01 -0700 Subject: [PATCH] Fix confusion of whether role_names are before or after rolemapping: better name of function: needed_constellation_role_names, fixes role mapping issue --- src/feditest/testplan.py | 12 ++++++------ src/feditest/testrun.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/feditest/testplan.py b/src/feditest/testplan.py index b0f03a9..5b32028 100644 --- a/src/feditest/testplan.py +++ b/src/feditest/testplan.py @@ -299,7 +299,7 @@ def get_test(self, context_msg : str = "" ) -> 'feditest.Test': return ret - def needed_role_names(self, context_msg : str = "" ) -> set[str]: + def needed_constellation_role_names(self, context_msg : str = "" ) -> set[str]: """ Return the names of the constellation roles needed after translation from whatever the test itself might call them locally. @@ -318,8 +318,8 @@ def needed_role_names(self, context_msg : str = "" ) -> set[str]: def check_can_be_executed(self, constellation: TestPlanConstellation, context_msg: str = "") -> None: test_context_msg = context_msg + f'Test "{ self.name }": ' - needed_role_names = self.needed_role_names(context_msg) # may raise - constellation.check_defines_all_role_names(needed_role_names, test_context_msg ) + needed_constellation_role_names = self.needed_constellation_role_names(context_msg) # may raise + constellation.check_defines_all_role_names(needed_constellation_role_names, test_context_msg ) def simplify(self) -> None: @@ -387,10 +387,10 @@ def check_can_be_executed(self, context_msg: str = "") -> None: test_spec.check_can_be_executed(self.constellation, context_msg + f'Test (index {index}): ') - def needed_role_names(self) -> set[str]: + def needed_constellation_role_names(self) -> set[str]: ret = set() for test in self.tests: - ret |= test.needed_role_names() + ret |= test.needed_constellation_role_names() return ret @@ -399,7 +399,7 @@ def instantiate_with_constellation(self, constellation: TestPlanConstellation, n Treat this session as a template. Create a new (non-template) session that's like this one and that uses the provided constellation. """ - constellation.check_defines_all_role_names(self.needed_role_names()) + constellation.check_defines_all_role_names(self.needed_constellation_role_names()) return TestPlanSession(constellation=constellation,tests=self.tests, name=name) diff --git a/src/feditest/testrun.py b/src/feditest/testrun.py index e83fed8..c6e550f 100644 --- a/src/feditest/testrun.py +++ b/src/feditest/testrun.py @@ -269,7 +269,7 @@ def run(self, controller: feditest.testruncontroller.TestRunController) -> None: info(f'Started test { self.str_in_session() }') args = {} - for local_role_name in self.plan_testspec.needed_role_names(): + for local_role_name in self.plan_testspec.get_test().needed_local_role_names(): constellation_role_name = local_role_name if self.plan_testspec.rolemapping and local_role_name in self.plan_testspec.rolemapping: constellation_role_name = self.plan_testspec.rolemapping[local_role_name]