示例#1
0
    def _to_proto_request(self):
        msg = _AlertService.UpdateAlertStatusRequest(
            status=self._ALERT_STATUS, )
        if self._sample_ids:
            msg.ok_sample_ids.extend(self._sample_ids)
        else:
            msg.clear_alerting_sample_ids = True

        return msg
示例#2
0
    def test_to_proto_request_no_sample_ids(self):
        status = Ok()
        proto_request = status._to_proto_request()

        assert proto_request == _AlertService.UpdateAlertStatusRequest(
            status=_AlertService.AlertStatusEnum.OK,
            alerting_sample_ids=[],
            ok_sample_ids=[],
            clear_alerting_sample_ids=True,
        )
示例#3
0
    def test_to_proto_request(self, sample_ids):
        status = Ok(sample_ids)
        proto_request = status._to_proto_request()

        assert proto_request == _AlertService.UpdateAlertStatusRequest(
            status=_AlertService.AlertStatusEnum.OK,
            alerting_sample_ids=[],
            ok_sample_ids=sample_ids,
            clear_alerting_sample_ids=False,
        )
示例#4
0
 def _to_proto_request(self):
     return _AlertService.UpdateAlertStatusRequest(
         status=self._ALERT_STATUS,
         alerting_sample_ids=self._sample_ids,
     )