| 54 | ) |
| 55 | |
| 56 | def test_http(self, tmpdir): |
| 57 | with requests_mock.Mocker() as mock: |
| 58 | mock.post("http://my-server", text=self.echo_response) |
| 59 | with taddons.context() as tctx: |
| 60 | a = tctx.script(example_dir.path("complex/jsondump.py")) |
| 61 | tctx.configure( |
| 62 | a, |
| 63 | dump_destination="http://my-server", |
| 64 | dump_username="user", |
| 65 | dump_password="pass", |
| 66 | ) |
| 67 | |
| 68 | tctx.invoke(a, "response", self.flow()) |
| 69 | tctx.invoke(a, "done") |
| 70 | |
| 71 | assert self.request["json"]["response"]["content"] == "message" |
| 72 | assert self.request["headers"]["Authorization"] == "Basic dXNlcjpwYXNz" |