| 1056 | |
| 1057 | |
| 1058 | class RequestOccurrence(MessageOccurrence): |
| 1059 | TYPE = "request" |
| 1060 | |
| 1061 | def __init__(self, message): |
| 1062 | assert isinstance(message, messaging.Request) |
| 1063 | super().__init__(message) |
| 1064 | self.response = None |
| 1065 | if isinstance(message, messaging.OutgoingRequest): |
| 1066 | self.on_response = message.on_response |
| 1067 | |
| 1068 | @property |
| 1069 | def command(self): |
| 1070 | return self.message.command |
| 1071 | |
| 1072 | @property |
| 1073 | def arguments(self): |
| 1074 | return self.message.arguments |
| 1075 | |
| 1076 | @property |
| 1077 | def _key(self): |
| 1078 | return self.command |
| 1079 | |
| 1080 | @property |
| 1081 | def _data(self): |
| 1082 | return self.arguments |
| 1083 | |
| 1084 | @property |
| 1085 | def _id(self): |
| 1086 | return super()._id + [("command", self.message.command)] |
| 1087 | |
| 1088 | def wait_for_response(self, freeze=True, raise_if_failed=True): |
| 1089 | response = Response(self, some.object).wait_until_realized(freeze) |
| 1090 | assert response.observed |
| 1091 | if raise_if_failed and not response.success: |
| 1092 | raise response.body |
| 1093 | else: |
| 1094 | return response |
| 1095 | |
| 1096 | |
| 1097 | class ResponseOccurrence(MessageOccurrence): |
no outgoing calls
no test coverage detected
searching dependent graphs…