diff --git a/tests/test_basics.py b/tests/test_basics.py index 7acbe83..f898367 100644 --- a/tests/test_basics.py +++ b/tests/test_basics.py @@ -4,7 +4,7 @@ import itertools import unittest -from subman import SubscriptionManager, SubscriptionState +from subman import SubscriptionManager, SubscriptionPolicy, SubscriptionState class SubmanTest(unittest.TestCase): @@ -53,6 +53,15 @@ def test_written_states(self) -> None: self.assertEqual(subman.written_states, all_states.difference(unwritten)) + def test_implicit_cleanup(self) -> None: + """Ensure implicits are marked as obsolet if they are no longer implied.""" + subman = SubscriptionManager() + state = SubscriptionState.implicit + policies = {SubscriptionPolicy.none, SubscriptionPolicy.moderated_opt_in, + SubscriptionPolicy.subscribable, SubscriptionPolicy.invitation_only} + for policy in policies: + self.assertTrue(subman.is_obsolete(policy, state, is_implied=False)) + if __name__ == "__main__": unittest.main()