Method
test_create_new_paste_failure
(self, pastebin, monkeypatch: MonkeyPatch)
Source from the content-addressed store, hash-verified
| 172 | assert "expiry=1week" in data.decode() |
| 173 | |
| 174 | def test_create_new_paste_failure(self, pastebin, monkeypatch: MonkeyPatch) -> None: |
| 175 | import io |
| 176 | import urllib.request |
| 177 | |
| 178 | def response(url, data): |
| 179 | stream = io.BytesIO(b"something bad occurred") |
| 180 | return stream |
| 181 | |
| 182 | monkeypatch.setattr(urllib.request, "urlopen", response) |
| 183 | result = pastebin.create_new_paste(b"full-paste-contents") |
| 184 | assert result == "bad response: invalid format ('something bad occurred')" |
Callers
nothing calls this directly
Tested by
no test coverage detected