diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/fixtures/tesla_mock/mstdn.jp_host_meta | 4 | ||||
| -rw-r--r-- | test/fixtures/tesla_mock/pekorino@pawoo.net_host_meta.json | 12 | ||||
| -rw-r--r-- | test/fixtures/tesla_mock/sdf.org_host_meta | 4 | ||||
| -rw-r--r-- | test/fixtures/tesla_mock/snowdusk@sdf.org_host_meta.json | 12 | ||||
| -rw-r--r-- | test/fixtures/tesla_mock/soykaf.com_host_meta | 4 | ||||
| -rw-r--r-- | test/fixtures/tesla_mock/stopwatchingus-heidelberg.de_host_meta | 31 | ||||
| -rw-r--r-- | test/fixtures/tesla_mock/xn--q9jyb4c_host_meta | 4 | ||||
| -rw-r--r-- | test/support/http_request_mock.ex | 175 | 
8 files changed, 246 insertions, 0 deletions
| diff --git a/test/fixtures/tesla_mock/mstdn.jp_host_meta b/test/fixtures/tesla_mock/mstdn.jp_host_meta new file mode 100644 index 000000000..e76ddd47f --- /dev/null +++ b/test/fixtures/tesla_mock/mstdn.jp_host_meta @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0"> +  <Link rel="lrdd" type="application/xrd+xml" template="https://mstdn.jp/.well-known/webfinger?resource={uri}"/> +</XRD> diff --git a/test/fixtures/tesla_mock/pekorino@pawoo.net_host_meta.json b/test/fixtures/tesla_mock/pekorino@pawoo.net_host_meta.json new file mode 100644 index 000000000..3757c0dad --- /dev/null +++ b/test/fixtures/tesla_mock/pekorino@pawoo.net_host_meta.json @@ -0,0 +1,12 @@ +{ +    "subject":"acct:pekorino@pawoo.net", +    "aliases":["https://pawoo.net/@pekorino","https://pawoo.net/users/pekorino"], +    "links":[ +        {"rel":"http://webfinger.net/rel/profile-page","type":"text/html","href":"https://pawoo.net/@pekorino"}, +        {"rel":"http://schemas.google.com/g/2010#updates-from","type":"application/atom+xml","href":"https://pawoo.net/users/pekorino.atom"}, +        {"rel":"self","type":"application/activity+json","href":"https://pawoo.net/users/pekorino"}, +        {"rel":"salmon","href":"https://pawoo.net/api/salmon/128378"}, +        {"rel":"magic-public-key","href":"data:application/magic-public-key,RSA.1x8XXmBqzyb-QRkfUKxKPd7Ac2KbaFhdKy2FkJY64G-ifga-BppzEb62Q5TdkRdVKdHjh5qI7A1Hk3KfnNQcNWqqak-jxII_txC2grbWpp7v-boceD2pnzdVK5l-RR-9wEwxcoCUeRWS1Ak6DStqE5tFQOAK4IIGQB-thSQGlU75KZ-2080fPA3Xc_ycH3_eB4YqawSxXrh6IeScMevN0YHSF84GAcvhXmwLKZRugiF6nYrknbPEe_niIOmN8hhEXLN9_4kDcH83hkVZd5VXssRrxqDhtokx9emvTHkA7sY1AjYeehTPZErlV74GN-kFYLeI6DluXoSI2sX1QcS08w==.AQAB"}, +        {"rel":"http://ostatus.org/schema/1.0/subscribe","template":"https://pawoo.net/authorize_follow?acct={uri}"} +    ] +} diff --git a/test/fixtures/tesla_mock/sdf.org_host_meta b/test/fixtures/tesla_mock/sdf.org_host_meta new file mode 100644 index 000000000..0ffc4f096 --- /dev/null +++ b/test/fixtures/tesla_mock/sdf.org_host_meta @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0"> +  <Link rel="lrdd" type="application/xrd+xml" template="https://mastodon.sdf.org/.well-known/webfinger?resource={uri}"/> +</XRD> diff --git a/test/fixtures/tesla_mock/snowdusk@sdf.org_host_meta.json b/test/fixtures/tesla_mock/snowdusk@sdf.org_host_meta.json new file mode 100644 index 000000000..273fc3804 --- /dev/null +++ b/test/fixtures/tesla_mock/snowdusk@sdf.org_host_meta.json @@ -0,0 +1,12 @@ +{ +    "subject":"acct:snowdusk@mastodon.sdf.org", +    "aliases":["https://mastodon.sdf.org/@snowdusk","https://mastodon.sdf.org/users/snowdusk"], +    "links":[ +        {"rel":"http://webfinger.net/rel/profile-page","type":"text/html","href":"https://mastodon.sdf.org/@snowdusk"}, +        {"rel":"http://schemas.google.com/g/2010#updates-from","type":"application/atom+xml","href":"https://mastodon.sdf.org/users/snowdusk.atom"}, +        {"rel":"self","type":"application/activity+json","href":"https://mastodon.sdf.org/users/snowdusk"}, +        {"rel":"salmon","href":"https://mastodon.sdf.org/api/salmon/2"}, +        {"rel":"magic-public-key","href":"data:application/magic-public-key,RSA.k4_Hr0WQUHumAD4uwWIz7OybovIKgIuanbXhX5pl7oGyb2TuifBf3nAqEhD6eLSo6-_6160L4BvPPV_l_6rlZEi6_nbeJUgVkayZgcZN3oou3IErSt8L0IbUdWT5s4fWM2zpkndLCkVbeeNQ3DOBccvJw7iA_QNTao8wr3ILvQaKEDnf-H5QBd9Tj3seyo4-7E0e6wCKOH_uBm8pSRgpdMdl2CehiFzaABBkmCeUKH-buU7iNQGi0fsV5VIHn6zffrv6p0EVNkjTDi1vTmmfrp9W0mcKZJ9DtvdehOKSgh3J7Mem-ILbPy6FSL2Oi6Ekj_Wh4M8Ie-YKuxI3N_0Baw==.AQAB"}, +        {"rel":"http://ostatus.org/schema/1.0/subscribe","template":"https://mastodon.sdf.org/authorize_interaction?uri={uri}"} +    ] +} diff --git a/test/fixtures/tesla_mock/soykaf.com_host_meta b/test/fixtures/tesla_mock/soykaf.com_host_meta new file mode 100644 index 000000000..99d552d32 --- /dev/null +++ b/test/fixtures/tesla_mock/soykaf.com_host_meta @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0"> +    <Link rel="lrdd" template="https://pleroma.soykaf.com/.well-known/webfinger?resource={uri}" type="application/xrd+xml" /> +</XRD> diff --git a/test/fixtures/tesla_mock/stopwatchingus-heidelberg.de_host_meta b/test/fixtures/tesla_mock/stopwatchingus-heidelberg.de_host_meta new file mode 100644 index 000000000..481cfec8d --- /dev/null +++ b/test/fixtures/tesla_mock/stopwatchingus-heidelberg.de_host_meta @@ -0,0 +1,31 @@ +{ +    "links":[ +        { +            "rel":"lrdd", +            "type":"application\/jrd+json", +            "template":"https:\/\/social.stopwatchingus-heidelberg.de\/.well-known\/webfinger?resource={uri}" +        }, +        { +            "rel":"lrdd", +            "type":"application\/json", +            "template":"https:\/\/social.stopwatchingus-heidelberg.de\/.well-known\/webfinger?resource={uri}" +        }, +        { +            "rel":"lrdd", +            "type":"application\/xrd+xml", +            "template":"https:\/\/social.stopwatchingus-heidelberg.de\/.well-known\/webfinger?resource={uri}" +        }, +        { +            "rel":"http:\/\/apinamespace.org\/oauth\/access_token", +            "href":"https:\/\/social.stopwatchingus-heidelberg.de\/api\/oauth\/access_token" +        }, +        { +            "rel":"http:\/\/apinamespace.org\/oauth\/request_token", +            "href":"https:\/\/social.stopwatchingus-heidelberg.de\/api\/oauth\/request_token" +        }, +        { +            "rel":"http:\/\/apinamespace.org\/oauth\/authorize", +            "href":"https:\/\/social.stopwatchingus-heidelberg.de\/api\/oauth\/authorize" +        } +    ] +} diff --git a/test/fixtures/tesla_mock/xn--q9jyb4c_host_meta b/test/fixtures/tesla_mock/xn--q9jyb4c_host_meta new file mode 100644 index 000000000..45d260e55 --- /dev/null +++ b/test/fixtures/tesla_mock/xn--q9jyb4c_host_meta @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0"> +    <Link rel="lrdd" template="https://zetsubou.xn--q9jyb4c/.well-known/webfinger?resource={uri}" type="application/xrd+xml" /> +</XRD> diff --git a/test/support/http_request_mock.ex b/test/support/http_request_mock.ex index b825a9307..4feb57f3a 100644 --- a/test/support/http_request_mock.ex +++ b/test/support/http_request_mock.ex @@ -344,6 +344,181 @@ defmodule HttpRequestMock do      {:error, :nxdomain}    end +  def get("http://osada.macgirvin.com/.well-known/host-meta", _, _, _) do +    {:ok, +     %Tesla.Env{ +       status: 404, +       body: "" +     }} +  end + +  def get("https://osada.macgirvin.com/.well-known/host-meta", _, _, _) do +    {:ok, +     %Tesla.Env{ +       status: 404, +       body: "" +     }} +  end + +  def get("http://mastodon.sdf.org/.well-known/host-meta", _, _, _) do +    {:ok, +     %Tesla.Env{ +       status: 200, +       body: File.read!("test/fixtures/tesla_mock/sdf.org_host_meta") +     }} +  end + +  def get("https://mastodon.sdf.org/.well-known/host-meta", _, _, _) do +    {:ok, +     %Tesla.Env{ +       status: 200, +       body: File.read!("test/fixtures/tesla_mock/sdf.org_host_meta") +     }} +  end + +  def get( +        "https://mastodon.sdf.org/.well-known/webfinger?resource=https://mastodon.sdf.org/users/snowdusk", +        _, +        _, +        _ +      ) do +    {:ok, +     %Tesla.Env{ +       status: 200, +       body: File.read!("test/fixtures/tesla_mock/snowdusk@sdf.org_host_meta.json") +     }} +  end + +  def get("http://mstdn.jp/.well-known/host-meta", _, _, _) do +    {:ok, +     %Tesla.Env{ +       status: 200, +       body: File.read!("test/fixtures/tesla_mock/mstdn.jp_host_meta") +     }} +  end + +  def get("https://mstdn.jp/.well-known/host-meta", _, _, _) do +    {:ok, +     %Tesla.Env{ +       status: 200, +       body: File.read!("test/fixtures/tesla_mock/mstdn.jp_host_meta") +     }} +  end + +  def get("https://mstdn.jp/.well-known/webfinger?resource=kpherox@mstdn.jp", _, _, _) do +    {:ok, +     %Tesla.Env{ +       status: 200, +       body: File.read!("test/fixtures/tesla_mock/kpherox@mstdn.jp.xml") +     }} +  end + +  def get("http://mamot.fr/.well-known/host-meta", _, _, _) do +    {:ok, +     %Tesla.Env{ +       status: 200, +       body: File.read!("test/fixtures/tesla_mock/mamot.fr_host_meta") +     }} +  end + +  def get("https://mamot.fr/.well-known/host-meta", _, _, _) do +    {:ok, +     %Tesla.Env{ +       status: 200, +       body: File.read!("test/fixtures/tesla_mock/mamot.fr_host_meta") +     }} +  end + +  def get( +        "https://mamot.fr/.well-known/webfinger?resource=https://mamot.fr/users/Skruyb", +        _, +        _, +        _ +      ) do +    {:ok, +     %Tesla.Env{ +       status: 200, +       body: File.read!("test/fixtures/tesla_mock/skruyb@mamot.fr.atom") +     }} +  end + +  def get("http://pawoo.net/.well-known/host-meta", _, _, _) do +    {:ok, +     %Tesla.Env{ +       status: 200, +       body: File.read!("test/fixtures/tesla_mock/pawoo.net_host_meta") +     }} +  end + +  def get("https://pawoo.net/.well-known/host-meta", _, _, _) do +    {:ok, +     %Tesla.Env{ +       status: 200, +       body: File.read!("test/fixtures/tesla_mock/pawoo.net_host_meta") +     }} +  end + +  def get( +        "https://pawoo.net/.well-known/webfinger?resource=https://pawoo.net/users/pekorino", +        _, +        _, +        _ +      ) do +    {:ok, +     %Tesla.Env{ +       status: 200, +       body: File.read!("test/fixtures/tesla_mock/pekorino@pawoo.net_host_meta.json") +     }} +  end + +  def get("http://zetsubou.xn--q9jyb4c/.well-known/host-meta", _, _, _) do +    {:ok, +     %Tesla.Env{ +       status: 200, +       body: File.read!("test/fixtures/tesla_mock/xn--q9jyb4c_host_meta") +     }} +  end + +  def get("https://zetsubou.xn--q9jyb4c/.well-known/host-meta", _, _, _) do +    {:ok, +     %Tesla.Env{ +       status: 200, +       body: File.read!("test/fixtures/tesla_mock/xn--q9jyb4c_host_meta") +     }} +  end + +  def get("http://pleroma.soykaf.com/.well-known/host-meta", _, _, _) do +    {:ok, +     %Tesla.Env{ +       status: 200, +       body: File.read!("test/fixtures/tesla_mock/soykaf.com_host_meta") +     }} +  end + +  def get("https://pleroma.soykaf.com/.well-known/host-meta", _, _, _) do +    {:ok, +     %Tesla.Env{ +       status: 200, +       body: File.read!("test/fixtures/tesla_mock/soykaf.com_host_meta") +     }} +  end + +  def get("http://social.stopwatchingus-heidelberg.de/.well-known/host-meta", _, _, _) do +    {:ok, +     %Tesla.Env{ +       status: 200, +       body: File.read!("test/fixtures/tesla_mock/stopwatchingus-heidelberg.de_host_meta") +     }} +  end + +  def get("https://social.stopwatchingus-heidelberg.de/.well-known/host-meta", _, _, _) do +    {:ok, +     %Tesla.Env{ +       status: 200, +       body: File.read!("test/fixtures/tesla_mock/stopwatchingus-heidelberg.de_host_meta") +     }} +  end +    def get(          "http://mastodon.example.org/@admin/99541947525187367",          _, | 
