From 1d01e8e656c364b97b9ee36a6173a830d3f5f4fc Mon Sep 17 00:00:00 2001 From: Sachin Joshi Date: Mon, 1 Apr 2019 22:12:02 +0545 Subject: [OStatus] adds status to pleroma instance if the url given is a status --- test/support/http_request_mock.ex | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test/support') diff --git a/test/support/http_request_mock.ex b/test/support/http_request_mock.ex index 78e8efc9d..2148bd4e7 100644 --- a/test/support/http_request_mock.ex +++ b/test/support/http_request_mock.ex @@ -36,6 +36,22 @@ defmodule HttpRequestMock do }} end + def get("https://mastodon.social/users/emelie/statuses/101849165031453009", _, _, _) do + {:ok, + %Tesla.Env{ + status: 200, + body: File.read!("test/fixtures/httpoison_mock/status.emelie.json") + }} + end + + def get("https://mastodon.social/users/emelie", _, _, _) do + {:ok, + %Tesla.Env{ + status: 200, + body: File.read!("test/fixtures/httpoison_mock/emelie.json") + }} + end + def get( "https://osada.macgirvin.com/.well-known/webfinger?resource=acct:mike@osada.macgirvin.com", _, -- cgit v1.2.3 From 6386c1c9c1ff971c784744922a479ae38e5fdbad Mon Sep 17 00:00:00 2001 From: Sachin Joshi Date: Tue, 2 Apr 2019 10:26:09 +0545 Subject: fetch url for OStatus to know if it is a/c or status --- test/support/http_request_mock.ex | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test/support') diff --git a/test/support/http_request_mock.ex b/test/support/http_request_mock.ex index 2148bd4e7..d3b547d91 100644 --- a/test/support/http_request_mock.ex +++ b/test/support/http_request_mock.ex @@ -52,6 +52,27 @@ defmodule HttpRequestMock do }} end + def get( + "https://mastodon.social/.well-known/webfinger?resource=https://mastodon.social/users/emelie", + _, + _, + _ + ) do + {:ok, + %Tesla.Env{ + status: 200, + body: File.read!("test/fixtures/httpoison_mock/webfinger_emelie.json") + }} + end + + def get("https://mastodon.social/users/emelie.atom", _, _, _) do + {:ok, + %Tesla.Env{ + status: 200, + body: File.read!("test/fixtures/httpoison_mock/emelie.atom") + }} + end + def get( "https://osada.macgirvin.com/.well-known/webfinger?resource=acct:mike@osada.macgirvin.com", _, -- cgit v1.2.3 From 15ce7104608869cb62c72c5beef0b23b1150cda0 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Tue, 2 Apr 2019 13:43:33 +0300 Subject: Added "GET /oauth/authorize" tests. --- test/support/factory.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/support') diff --git a/test/support/factory.ex b/test/support/factory.ex index 18f77f01a..e1a08315a 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -216,7 +216,7 @@ defmodule Pleroma.Factory do redirect_uris: "https://example.com/callback", scopes: ["read", "write", "follow", "push"], website: "https://example.com", - client_id: "aaabbb==", + client_id: Ecto.UUID.generate(), client_secret: "aaa;/&bbb" } end -- cgit v1.2.3 From f7cd9131d4aa0da3c4c0174acc56ce1bbdbd284c Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Thu, 4 Apr 2019 22:41:03 +0300 Subject: [#923] OAuth consumer controller tests. Misc. improvements. --- test/support/factory.ex | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test/support') diff --git a/test/support/factory.ex b/test/support/factory.ex index e1a08315a..67953931b 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -257,4 +257,20 @@ defmodule Pleroma.Factory do user: build(:user) } end + + def registration_factory do + user = insert(:user) + + %Pleroma.Registration{ + user: user, + provider: "twitter", + uid: "171799000", + info: %{ + "name" => "John Doe", + "email" => "john@doe.com", + "nickname" => "johndoe", + "description" => "My bio" + } + } + end end -- cgit v1.2.3 From 325a2680173f714a5875ed726f9171e7984f7f7a Mon Sep 17 00:00:00 2001 From: Sergey Suprunenko Date: Fri, 5 Apr 2019 23:36:42 +0000 Subject: Redirect to the referer url after mastofe authorization --- test/support/factory.ex | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/support') diff --git a/test/support/factory.ex b/test/support/factory.ex index e1a08315a..b37bc2c07 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -240,6 +240,16 @@ defmodule Pleroma.Factory do } end + def oauth_authorization_factory do + %Pleroma.Web.OAuth.Authorization{ + token: :crypto.strong_rand_bytes(32) |> Base.url_encode64(padding: false), + scopes: ["read", "write", "follow", "push"], + valid_until: NaiveDateTime.add(NaiveDateTime.utc_now(), 60 * 10), + user: build(:user), + app: build(:oauth_app) + } + end + def push_subscription_factory do %Pleroma.Web.Push.Subscription{ user: build(:user), -- cgit v1.2.3 From 7bf622ce736af12db9b4865d8d3c2db5792d6f03 Mon Sep 17 00:00:00 2001 From: eugenijm Date: Thu, 28 Mar 2019 12:39:10 +0300 Subject: Add scheduled activities --- test/support/factory.ex | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/support') diff --git a/test/support/factory.ex b/test/support/factory.ex index b37bc2c07..667f59e8c 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -23,6 +23,14 @@ defmodule Pleroma.Factory do } end + def scheduled_activity_factory do + %Pleroma.ScheduledActivity{ + user: build(:user), + scheduled_at: NaiveDateTime.add(NaiveDateTime.utc_now(), :timer.minutes(60), :millisecond), + params: build(:note) |> Map.from_struct() |> Map.get(:data) + } + end + def note_factory(attrs \\ %{}) do text = sequence(:text, &"This is :moominmamma: note #{&1}") -- cgit v1.2.3 From fc92a0fd8d5be0352f4791b79bda04960f36f707 Mon Sep 17 00:00:00 2001 From: eugenijm Date: Tue, 2 Apr 2019 01:31:01 +0300 Subject: Added limits and media attachments for scheduled activities. --- test/support/factory.ex | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'test/support') diff --git a/test/support/factory.ex b/test/support/factory.ex index 667f59e8c..608f8d46b 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -23,14 +23,6 @@ defmodule Pleroma.Factory do } end - def scheduled_activity_factory do - %Pleroma.ScheduledActivity{ - user: build(:user), - scheduled_at: NaiveDateTime.add(NaiveDateTime.utc_now(), :timer.minutes(60), :millisecond), - params: build(:note) |> Map.from_struct() |> Map.get(:data) - } - end - def note_factory(attrs \\ %{}) do text = sequence(:text, &"This is :moominmamma: note #{&1}") @@ -275,4 +267,12 @@ defmodule Pleroma.Factory do user: build(:user) } end + + def scheduled_activity_factory do + %Pleroma.ScheduledActivity{ + user: build(:user), + scheduled_at: NaiveDateTime.add(NaiveDateTime.utc_now(), :timer.minutes(60), :millisecond), + params: build(:note) |> Map.from_struct() |> Map.get(:data) + } + end end -- cgit v1.2.3