__________________________ TestSubjectsApi.test_crud ___________________________

self = <tests.test_api_recipients_subjects_templates.TestSubjectsApi object at 0x7fc8207e5410>
api = <starlette.testclient.TestClient object at 0x7fc81a021fd0>

    def test_crud(self, api):
        r = api.post("/subjects", headers=H(api),
                     json={"subject": "Invoice %RandomInvoiceNumber% due"})
        assert r.status_code in (200, 201), r.text
        sid = sub_id_of(r)
    
        assert any(s["id"] == sid for s in api.get("/subjects/list").json()["subjects"])
    
        r3 = api.put(f"/subjects/{sid}", headers=H(api), json={"subject": "Updated subject"})
        assert r3.status_code == 200, r3.text
    
        r4 = api.get(f"/subjects/{sid}")
>       assert r4.status_code == 200
E       assert 405 == 200
E        +  where 405 = <Response [405 Method Not Allowed]>.status_code

tests/test_api_recipients_subjects_templates.py:257: AssertionError
--
        has_content_type_header = any("content-type" in key.lower() for key in headers)
        if content_type is not None and not has_content_type_header:
            # note that unlike requests, we ignore the content_type provided in the 3rd
            # tuple element if it is also included in the headers requests does
            # the opposite (it overwrites the headerwith the 3rd tuple element)
            headers["Content-Type"] = content_type
    
        if isinstance(fileobj, io.StringIO):
>           raise TypeError(
                "Multipart file uploads require 'io.BytesIO', not 'io.StringIO'."
            )
E           TypeError: Multipart file uploads require 'io.BytesIO', not 'io.StringIO'.

/usr/local/lib/python3.11/site-packages/httpx/_multipart.py:159: TypeError
