(self, cmd)
| 71 | raise CalledProcessError(1, token, "Failing command on purpose") |
| 72 | |
| 73 | def check_output(self, cmd): |
| 74 | with self.lock: |
| 75 | self.check_call(cmd) |
| 76 | return_string = "command-output" |
| 77 | key_to_shrink = None |
| 78 | for pattern, response_list in self.call_response.items(): |
| 79 | if pattern in str(cmd): |
| 80 | return_string = response_list[0] |
| 81 | key_to_shrink = pattern |
| 82 | break |
| 83 | if key_to_shrink: |
| 84 | self.call_response[key_to_shrink] = self.call_response[key_to_shrink][ |
| 85 | 1: |
| 86 | ] |
| 87 | if len(self.call_response[key_to_shrink]) == 0: |
| 88 | del self.call_response[key_to_shrink] |
| 89 | |
| 90 | return return_string.encode() |
| 91 | |
| 92 | def assert_has_call( |
| 93 | self, ip: str, pattern: Optional[str] = None, exact: Optional[List[str]] = None |
no test coverage detected