Skip to content

Commit

Permalink
tests: Ensure implicits are marked as obsolet if they are no longer i…
Browse files Browse the repository at this point in the history
…mplied.
  • Loading branch information
larsesser committed Nov 10, 2023
1 parent d41d9ba commit de6a234
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests/test_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import itertools
import unittest

from subman import SubscriptionManager, SubscriptionState
from subman import SubscriptionManager, SubscriptionPolicy, SubscriptionState


class SubmanTest(unittest.TestCase):
Expand Down Expand Up @@ -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()

0 comments on commit de6a234

Please sign in to comment.