summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorcall-me-matt <nextcloud@matthiasheinisch.de>2023-07-07 00:45:04 +0200
committercall-me-matt <nextcloud@matthiasheinisch.de>2023-07-27 12:15:06 +0200
commit115b1b47335c79ee5b8f11c8e2c8f1f45da7e357 (patch)
tree63b0c215dff76f6801f4cb3e05ace0126d9b53a3 /tests
parentcecab50d2d56d4c01852e4139ce5dc80197ada64 (diff)
change Mastodon tree for social avatar
Signed-off-by: call-me-matt <nextcloud@matthiasheinisch.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/Service/Social/MastodonProviderTest.php44
1 files changed, 30 insertions, 14 deletions
diff --git a/tests/unit/Service/Social/MastodonProviderTest.php b/tests/unit/Service/Social/MastodonProviderTest.php
index 10357a63..bcb4c75d 100644
--- a/tests/unit/Service/Social/MastodonProviderTest.php
+++ b/tests/unit/Service/Social/MastodonProviderTest.php
@@ -82,6 +82,22 @@ class MastodonProviderTest extends TestCase {
* @dataProvider dataProviderSupportsContact
*/
public function testSupportsContact($contact, $expected) {
+ $this->client->method("get")->willReturn($this->response);
+ $this->body = '{
+ "subject": "acct:user1@cloud1",
+ "aliases": [
+ "https://cloud1/@user1",
+ "https://cloud1/users/user1"
+ ],
+ "links": [
+ {
+ "rel": "self",
+ "type": "application/activity+json",
+ "href": "https://cloud1/users/user1"
+ }
+ ]
+ }';
+ $this->response->method("getBody")->willReturn($this->body);
$result = $this->provider->supportsContact($contact);
$this->assertEquals($expected, $result);
}
@@ -98,20 +114,20 @@ class MastodonProviderTest extends TestCase {
]
];
$contactWithSocialUrls = [
- "https://cloud1/api/v2/search?q=user1@cloud1",
- "https://cloud2/api/v2/search?q=user2@cloud2",
- "https://cloud3//api/v2/search?q=user3@cloud3",
- "https://cloud1/api/v1/accounts/1",
- "https://cloud2/api/v1/accounts/2",
- "https://cloud3//api/v1/accounts/3"
+ "https://cloud1/.well-known/webfinger?resource=acct:user1@cloud1",
+ "https://cloud2/.well-known/webfinger?resource=acct:user2@cloud2",
+ "https://cloud3/.well-known/webfinger?resource=acct:user3@cloud3",
+ "https://cloud1/users/user1",
+ "https://cloud2/users/user2",
+ "https://cloud3/users/user3",
];
$contactWithSocialApi = [
- '{"accounts":[{"id":"1","username":"user1"}]}',
- '{"accounts":[{"id":"2","username":"user2"}]}',
- '{"accounts":[{"id":"3","username":"user3"}]}',
- '{"id":"1","avatar":"user1.jpg"}',
- '{"id":"2","avatar":"user2.jpg"}',
- '{"id":"3","avatar":"user3.jpg"}'
+ '{"subject":"acct:user1@cloud1","aliases":["https://cloud1/@user1","https://cloud1/users/user1"],"links":[{"rel":"self","type":"application/activity+json","href":"https://cloud1/users/user1"}]}',
+ '{"subject":"acct:user2@cloud2","aliases":["https://cloud2/@user2","https://cloud2/users/user2"],"links":[{"rel":"self","type":"application/activity+json","href":"https://cloud2/users/user2"}]}',
+ '{"subject":"acct:user3@cloud3","aliases":["https://cloud3/@user3","https://cloud3/users/user3"],"links":[{"rel":"self","type":"application/activity+json","href":"https://cloud3/users/user3"}]}',
+ '{"id":"1","icon":{"url":"user1.jpg"}}',
+ '{"id":"2","icon":{"url":"user2.jpg"}}',
+ '{"id":"3","icon":{"url":"user3.jpg"}}',
];
$contactWithSocialImgs = [
"user1.jpg",
@@ -121,8 +137,8 @@ class MastodonProviderTest extends TestCase {
$contactWithoutSocial = [
'X-SOCIALPROFILE' => [
- ["value" => "one", "type" => "social2"],
- ["value" => "two", "type" => "social1"]
+ ["value" => "one", "type" => "socialx"],
+ ["value" => "two", "type" => "socialy"]
]
];
$contactWithoutSocialUrls = [];