def METHOD_NAME(self, con100, tmp_path, requests_mock):
    source = tmp_path / "to-upload.txt"
    source.write_bytes(b"hello world\n")
    f = UserFile("foo.txt", connection=con100)
    def put_files(request, context):
        import io
        if isinstance(request.text, io.BufferedReader):
            body = request.text.read()
        else:
            body = request.text
        assert body == b"hello world\n"
        context.status_code = 200
        return {
            "path": "foo.txt",
            "size": len(body),
            "modified": "2018-01-03T10:55:29Z",
        }
    upload_mock = requests_mock.put(API_URL + "/files/foo.txt", json=put_files)
    f2 = f.upload(source)
    assert f2.path == PurePosixPath("foo.txt")
    assert f2.metadata == {
        "path": "foo.txt",
        "size": 12,
        "modified": "2018-01-03T10:55:29Z",
    }
    assert upload_mock.call_count == 1