kopia lustrzana https://github.com/tsileo/little-boxes
More tests
rodzic
619883cc8f
commit
6088360c25
|
@ -1,5 +1,6 @@
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
from typing import Dict, Any
|
from typing import Dict
|
||||||
|
from typing import Any
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
|
from unittest import mock
|
||||||
import logging
|
import logging
|
||||||
|
import json
|
||||||
|
|
||||||
from little_boxes import webfinger
|
from little_boxes import webfinger
|
||||||
|
|
||||||
|
import httpretty
|
||||||
|
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,7 +31,20 @@ _WEBFINGER_RESP = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def test_webfinger():
|
@mock.patch("little_boxes.webfinger.check_url", return_value=None)
|
||||||
|
@httpretty.activate
|
||||||
|
def test_webfinger(_):
|
||||||
|
# FIXME(tsileo): it should try https first
|
||||||
|
httpretty.register_uri(
|
||||||
|
httpretty.GET,
|
||||||
|
"http://microblog.pub/.well-known/webfinger",
|
||||||
|
body=json.dumps(_WEBFINGER_RESP),
|
||||||
|
)
|
||||||
data = webfinger.webfinger("@dev@microblog.pub")
|
data = webfinger.webfinger("@dev@microblog.pub")
|
||||||
|
|
||||||
assert data == _WEBFINGER_RESP
|
assert data == _WEBFINGER_RESP
|
||||||
|
|
||||||
|
assert webfinger.get_actor_url("@dev@microblog.pub") == "https://microblog.pub"
|
||||||
|
assert (
|
||||||
|
webfinger.get_remote_follow_template("@dev@microblog.pub")
|
||||||
|
== "https://microblog.pub/authorize_follow?profile={uri}"
|
||||||
|
)
|
||||||
|
|
Ładowanie…
Reference in New Issue