aboutsummaryrefslogtreecommitdiffstats
path: root/apps/settings/tests
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-11-22 09:54:41 +0100
committerCarl Schwan <carl@carlschwan.eu>2022-11-22 10:06:19 +0100
commite35bcc9381246a8ec3da96e78e9771ef6044a6d4 (patch)
tree879b0effe8e087a21a5f8747a00f083bcbb15ca8 /apps/settings/tests
parentd1209d83023aaae7b844f4fc3b3668643718de14 (diff)
downloadnextcloud-server-e35bcc9381246a8ec3da96e78e9771ef6044a6d4.tar.gz
nextcloud-server-e35bcc9381246a8ec3da96e78e9771ef6044a6d4.zip
Fix tests
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'apps/settings/tests')
-rw-r--r--apps/settings/tests/Controller/UsersControllerTest.php33
1 files changed, 29 insertions, 4 deletions
diff --git a/apps/settings/tests/Controller/UsersControllerTest.php b/apps/settings/tests/Controller/UsersControllerTest.php
index 797fa1621fa..9ad81148ef1 100644
--- a/apps/settings/tests/Controller/UsersControllerTest.php
+++ b/apps/settings/tests/Controller/UsersControllerTest.php
@@ -241,6 +241,11 @@ class UsersControllerTest extends \Test\TestCase {
'Default twitter',
IAccountManager::SCOPE_LOCAL,
),
+ IAccountManager::PROPERTY_FEDIVERSE => $this->buildPropertyMock(
+ IAccountManager::PROPERTY_FEDIVERSE,
+ 'Default twitter',
+ IAccountManager::SCOPE_LOCAL,
+ ),
];
$account = $this->createMock(IAccount::class);
@@ -336,6 +341,8 @@ class UsersControllerTest extends \Test\TestCase {
$addressScope = IAccountManager::SCOPE_PUBLISHED;
$twitter = '@nextclouders';
$twitterScope = IAccountManager::SCOPE_PUBLISHED;
+ $fediverse = '@nextclouders@floss.social';
+ $fediverseScope = IAccountManager::SCOPE_PUBLISHED;
$user = $this->createMock(IUser::class);
$user->method('getUID')->willReturn('johndoe');
@@ -410,7 +417,9 @@ class UsersControllerTest extends \Test\TestCase {
$address,
$addressScope,
$twitter,
- $twitterScope
+ $twitterScope,
+ $fediverse,
+ $fediverseScope
);
}
@@ -447,6 +456,8 @@ class UsersControllerTest extends \Test\TestCase {
$addressScope = IAccountManager::SCOPE_PUBLISHED;
$twitter = '@nextclouders';
$twitterScope = IAccountManager::SCOPE_PUBLISHED;
+ $fediverse = '@nextclouders@floss.social';
+ $fediverseScope = IAccountManager::SCOPE_PUBLISHED;
// All settings are changed (in the past phone, website, address and
// twitter were not changed).
@@ -464,6 +475,8 @@ class UsersControllerTest extends \Test\TestCase {
$expectedProperties[IAccountManager::PROPERTY_ADDRESS]['scope'] = $addressScope;
$expectedProperties[IAccountManager::PROPERTY_TWITTER]['value'] = $twitter;
$expectedProperties[IAccountManager::PROPERTY_TWITTER]['scope'] = $twitterScope;
+ $expectedProperties[IAccountManager::PROPERTY_FEDIVERSE]['value'] = $fediverse;
+ $expectedProperties[IAccountManager::PROPERTY_FEDIVERSE]['scope'] = $fediverseScope;
$this->mailer->expects($this->once())->method('validateMailAddress')
->willReturn(true);
@@ -485,7 +498,9 @@ class UsersControllerTest extends \Test\TestCase {
$address,
$addressScope,
$twitter,
- $twitterScope
+ $twitterScope,
+ $fediverse,
+ $fediverseScope
);
}
@@ -523,6 +538,8 @@ class UsersControllerTest extends \Test\TestCase {
$addressScope = ($property === 'addressScope') ? $propertyValue : null;
$twitter = ($property === 'twitter') ? $propertyValue : null;
$twitterScope = ($property === 'twitterScope') ? $propertyValue : null;
+ $fediverse = ($property === 'fediverse') ? $propertyValue : null;
+ $fediverseScope = ($property === 'fediverseScope') ? $propertyValue : null;
/** @var IAccountProperty[]|MockObject[] $expectedProperties */
$expectedProperties = $userAccount->getProperties();
@@ -555,6 +572,10 @@ class UsersControllerTest extends \Test\TestCase {
case 'twitterScope':
$propertyId = IAccountManager::PROPERTY_TWITTER;
break;
+ case 'fediverse':
+ case 'fediverseScope':
+ $propertyId = IAccountManager::PROPERTY_FEDIVERSE;
+ break;
default:
$propertyId = '404';
}
@@ -584,7 +605,9 @@ class UsersControllerTest extends \Test\TestCase {
$address,
$addressScope,
$twitter,
- $twitterScope
+ $twitterScope,
+ $fediverse,
+ $fediverseScope
);
}
@@ -603,6 +626,8 @@ class UsersControllerTest extends \Test\TestCase {
['addressScope', IAccountManager::SCOPE_PUBLISHED],
['twitter', '@nextclouders'],
['twitterScope', IAccountManager::SCOPE_PUBLISHED],
+ ['fediverse', '@nextclouders@floss.social'],
+ ['fediverseScope', IAccountManager::SCOPE_PUBLISHED],
];
}
@@ -822,7 +847,7 @@ class UsersControllerTest extends \Test\TestCase {
$signature = 'theSignature';
$code = $message . ' ' . $signature;
- if ($type === IAccountManager::PROPERTY_TWITTER) {
+ if ($type === IAccountManager::PROPERTY_TWITTER || $type === IAccountManager::PROPERTY_FEDIVERSE) {
$code = $message . ' ' . md5($signature);
}