(self, pastebin, mocked_urlopen)
| 160 | assert len(mocked_urlopen_fail) == 1 |
| 161 | |
| 162 | def test_create_new_paste(self, pastebin, mocked_urlopen) -> None: |
| 163 | result = pastebin.create_new_paste(b"full-paste-contents") |
| 164 | assert result == "https://bpa.st/show/3c0c6750bd" |
| 165 | assert len(mocked_urlopen) == 1 |
| 166 | url, data = mocked_urlopen[0] |
| 167 | assert type(data) is bytes |
| 168 | lexer = "text" |
| 169 | assert url == "https://bpa.st" |
| 170 | assert "lexer=%s" % lexer in data.decode() |
| 171 | assert "code=full-paste-contents" in data.decode() |
| 172 | assert "expiry=1week" in data.decode() |
| 173 | |
| 174 | def test_create_new_paste_failure(self, pastebin, monkeypatch: MonkeyPatch) -> None: |
| 175 | import io |
nothing calls this directly
no outgoing calls
no test coverage detected