Skip to content

Commit a829edb

Browse files
committed
Fix for profile bug, closes #16
1 parent cf726da commit a829edb

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

datasette_indieauth/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ async def indieauth_done(request, datasette):
142142
if "scope" in info:
143143
actor["indieauth_scope"] = info["scope"]
144144

145-
if "profile" in info and isinstance(info["profile", dict]):
145+
if "profile" in info and isinstance(info["profile"], dict):
146146
actor.update(info["profile"])
147147
response = Response.redirect(datasette.urls.instance())
148148
response.set_cookie(

tests/test_indieauth.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,10 @@ async def test_indieauth_succeeds(httpx_mock):
130130
url="https://indieauth.simonwillison.net/auth",
131131
method="POST",
132132
data=json.dumps(
133-
{"me": "https://indieauth.simonwillison.net/index.php/author/simonw/"}
133+
{
134+
"me": "https://indieauth.simonwillison.net/index.php/author/simonw/",
135+
"profile": {"email": "[email protected]"},
136+
}
134137
).encode("utf-8"),
135138
)
136139
datasette = Datasette([], memory=True)
@@ -191,5 +194,6 @@ async def test_indieauth_succeeds(httpx_mock):
191194
"a": {
192195
"me": "https://indieauth.simonwillison.net/index.php/author/simonw/",
193196
"display": "indieauth.simonwillison.net/index.php/author/simonw/",
197+
"email": "[email protected]",
194198
}
195199
}

0 commit comments

Comments
 (0)