def test_create(self, comparison, threshold): alerter = FixedAlerter(comparison(threshold)) msg = _AlertService.AlertFixed( threshold=threshold, operator=comparison._OPERATOR, ) assert alerter._as_proto() == msg
def test_from_proto(self, comparison, threshold): msg = _AlertService.AlertFixed( threshold=threshold, operator=comparison._OPERATOR, ) alerter = _Alerter._from_proto(msg) assert type(alerter) is FixedAlerter assert alerter._as_proto() == msg
def _as_proto(self): return _AlertService.AlertFixed( threshold=self._comparison.value, operator=self._comparison._operator_as_proto(), )