def get_subject(self, context: Mapping[str, Any] | None = None) -> str: if not context: # This shouldn't be possible but adding a message just in case. return "Digest Report" return get_digest_subject(context["group"], context["counts"], context["start"])
def test_get_digest_subject(self): assert (get_digest_subject( mock.Mock(qualified_short_id="BAR-1"), Counter({mock.sentinel.group: 3}), datetime(2016, 9, 19, 1, 2, 3, tzinfo=pytz.utc), ) == "BAR-1 - 1 new alert since Sept. 19, 2016, 1:02 a.m. UTC")