예제 #1
0
    def test_create(self, comparison, threshold):
        alerter = FixedAlerter(comparison(threshold))

        msg = _AlertService.AlertFixed(
            threshold=threshold,
            operator=comparison._OPERATOR,
        )
        assert alerter._as_proto() == msg
예제 #2
0
    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
예제 #3
0
 def _as_proto(self):
     return _AlertService.AlertFixed(
         threshold=self._comparison.value,
         operator=self._comparison._operator_as_proto(),
     )