mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Fix tests
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
This commit is contained in:
parent
d1209d8302
commit
e35bcc9381
4 changed files with 83 additions and 4 deletions
|
|
@ -181,6 +181,7 @@ abstract class AUserData extends OCSController {
|
|||
IAccountManager::PROPERTY_ADDRESS,
|
||||
IAccountManager::PROPERTY_WEBSITE,
|
||||
IAccountManager::PROPERTY_TWITTER,
|
||||
IAccountManager::PROPERTY_FEDIVERSE,
|
||||
IAccountManager::PROPERTY_ORGANISATION,
|
||||
IAccountManager::PROPERTY_ROLE,
|
||||
IAccountManager::PROPERTY_HEADLINE,
|
||||
|
|
|
|||
|
|
@ -1008,6 +1008,7 @@ class UsersControllerTest extends TestCase {
|
|||
IAccountManager::PROPERTY_ADDRESS => ['value' => 'address'],
|
||||
IAccountManager::PROPERTY_PHONE => ['value' => 'phone'],
|
||||
IAccountManager::PROPERTY_TWITTER => ['value' => 'twitter'],
|
||||
IAccountManager::PROPERTY_FEDIVERSE => ['value' => 'fediverse'],
|
||||
IAccountManager::PROPERTY_WEBSITE => ['value' => 'website'],
|
||||
IAccountManager::PROPERTY_ORGANISATION => ['value' => 'organisation'],
|
||||
IAccountManager::PROPERTY_ROLE => ['value' => 'role'],
|
||||
|
|
@ -1075,6 +1076,7 @@ class UsersControllerTest extends TestCase {
|
|||
'address' => 'address',
|
||||
'website' => 'website',
|
||||
'twitter' => 'twitter',
|
||||
'fediverse' => 'fediverse',
|
||||
'groups' => ['group0', 'group1', 'group2'],
|
||||
'language' => 'de',
|
||||
'locale' => null,
|
||||
|
|
@ -1186,6 +1188,7 @@ class UsersControllerTest extends TestCase {
|
|||
IAccountManager::PROPERTY_ADDRESS => ['value' => 'address'],
|
||||
IAccountManager::PROPERTY_PHONE => ['value' => 'phone'],
|
||||
IAccountManager::PROPERTY_TWITTER => ['value' => 'twitter'],
|
||||
IAccountManager::PROPERTY_FEDIVERSE => ['value' => 'fediverse'],
|
||||
IAccountManager::PROPERTY_WEBSITE => ['value' => 'website'],
|
||||
IAccountManager::PROPERTY_ORGANISATION => ['value' => 'organisation'],
|
||||
IAccountManager::PROPERTY_ROLE => ['value' => 'role'],
|
||||
|
|
@ -1214,6 +1217,7 @@ class UsersControllerTest extends TestCase {
|
|||
'address' => 'address',
|
||||
'website' => 'website',
|
||||
'twitter' => 'twitter',
|
||||
'fediverse' => 'fediverse',
|
||||
'groups' => [],
|
||||
'language' => 'da',
|
||||
'locale' => null,
|
||||
|
|
@ -1364,6 +1368,7 @@ class UsersControllerTest extends TestCase {
|
|||
IAccountManager::PROPERTY_ADDRESS => ['value' => 'address'],
|
||||
IAccountManager::PROPERTY_PHONE => ['value' => 'phone'],
|
||||
IAccountManager::PROPERTY_TWITTER => ['value' => 'twitter'],
|
||||
IAccountManager::PROPERTY_FEDIVERSE => ['value' => 'fediverse'],
|
||||
IAccountManager::PROPERTY_WEBSITE => ['value' => 'website'],
|
||||
IAccountManager::PROPERTY_ORGANISATION => ['value' => 'organisation'],
|
||||
IAccountManager::PROPERTY_ROLE => ['value' => 'role'],
|
||||
|
|
@ -1391,6 +1396,7 @@ class UsersControllerTest extends TestCase {
|
|||
'address' => 'address',
|
||||
'website' => 'website',
|
||||
'twitter' => 'twitter',
|
||||
'fediverse' => 'fediverse',
|
||||
'groups' => [],
|
||||
'language' => 'ru',
|
||||
'locale' => null,
|
||||
|
|
@ -1582,6 +1588,7 @@ class UsersControllerTest extends TestCase {
|
|||
public function selfEditChangePropertyProvider() {
|
||||
return [
|
||||
[IAccountManager::PROPERTY_TWITTER, '@oldtwitter', '@newtwitter'],
|
||||
[IAccountManager::PROPERTY_FEDIVERSE, '@oldFediverse@floss.social', '@newFediverse@floss.social'],
|
||||
[IAccountManager::PROPERTY_PHONE, '1234', '12345'],
|
||||
[IAccountManager::PROPERTY_ADDRESS, 'Something street 2', 'Another street 3'],
|
||||
[IAccountManager::PROPERTY_WEBSITE, 'https://examplesite1', 'https://examplesite2'],
|
||||
|
|
@ -1658,6 +1665,7 @@ class UsersControllerTest extends TestCase {
|
|||
[IAccountManager::PROPERTY_DISPLAYNAME, IAccountManager::SCOPE_LOCAL, IAccountManager::SCOPE_FEDERATED],
|
||||
[IAccountManager::PROPERTY_EMAIL, IAccountManager::SCOPE_LOCAL, IAccountManager::SCOPE_FEDERATED],
|
||||
[IAccountManager::PROPERTY_TWITTER, IAccountManager::SCOPE_LOCAL, IAccountManager::SCOPE_FEDERATED],
|
||||
[IAccountManager::PROPERTY_FEDIVERSE, IAccountManager::SCOPE_LOCAL, IAccountManager::SCOPE_FEDERATED],
|
||||
[IAccountManager::PROPERTY_PHONE, IAccountManager::SCOPE_LOCAL, IAccountManager::SCOPE_FEDERATED],
|
||||
[IAccountManager::PROPERTY_ADDRESS, IAccountManager::SCOPE_LOCAL, IAccountManager::SCOPE_FEDERATED],
|
||||
[IAccountManager::PROPERTY_WEBSITE, IAccountManager::SCOPE_LOCAL, IAccountManager::SCOPE_FEDERATED],
|
||||
|
|
@ -3543,6 +3551,7 @@ class UsersControllerTest extends TestCase {
|
|||
'address' => 'address',
|
||||
'website' => 'website',
|
||||
'twitter' => 'twitter',
|
||||
'fediverse' => 'fediverse',
|
||||
'organisation' => 'organisation',
|
||||
'role' => 'role',
|
||||
'headline' => 'headline',
|
||||
|
|
@ -3560,6 +3569,7 @@ class UsersControllerTest extends TestCase {
|
|||
'address' => 'address',
|
||||
'website' => 'website',
|
||||
'twitter' => 'twitter',
|
||||
'fediverse' => 'fediverse',
|
||||
'organisation' => 'organisation',
|
||||
'role' => 'role',
|
||||
'headline' => 'headline',
|
||||
|
|
@ -3622,6 +3632,7 @@ class UsersControllerTest extends TestCase {
|
|||
'address' => 'address',
|
||||
'website' => 'website',
|
||||
'twitter' => 'twitter',
|
||||
'fediverse' => 'fediverse',
|
||||
'displayname' => 'Demo User',
|
||||
'organisation' => 'organisation',
|
||||
'role' => 'role',
|
||||
|
|
@ -3946,6 +3957,7 @@ class UsersControllerTest extends TestCase {
|
|||
IAccountManager::PROPERTY_ADDRESS,
|
||||
IAccountManager::PROPERTY_WEBSITE,
|
||||
IAccountManager::PROPERTY_TWITTER,
|
||||
IAccountManager::PROPERTY_FEDIVERSE,
|
||||
IAccountManager::PROPERTY_ORGANISATION,
|
||||
IAccountManager::PROPERTY_ROLE,
|
||||
IAccountManager::PROPERTY_HEADLINE,
|
||||
|
|
@ -3960,6 +3972,7 @@ class UsersControllerTest extends TestCase {
|
|||
IAccountManager::PROPERTY_ADDRESS,
|
||||
IAccountManager::PROPERTY_WEBSITE,
|
||||
IAccountManager::PROPERTY_TWITTER,
|
||||
IAccountManager::PROPERTY_FEDIVERSE,
|
||||
IAccountManager::PROPERTY_ORGANISATION,
|
||||
IAccountManager::PROPERTY_ROLE,
|
||||
IAccountManager::PROPERTY_HEADLINE,
|
||||
|
|
@ -3973,6 +3986,7 @@ class UsersControllerTest extends TestCase {
|
|||
IAccountManager::PROPERTY_ADDRESS,
|
||||
IAccountManager::PROPERTY_WEBSITE,
|
||||
IAccountManager::PROPERTY_TWITTER,
|
||||
IAccountManager::PROPERTY_FEDIVERSE,
|
||||
IAccountManager::PROPERTY_ORGANISATION,
|
||||
IAccountManager::PROPERTY_ROLE,
|
||||
IAccountManager::PROPERTY_HEADLINE,
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -156,6 +156,11 @@ class AccountManagerTest extends TestCase {
|
|||
'value' => '@sometwitter',
|
||||
'scope' => IAccountManager::SCOPE_PUBLISHED
|
||||
],
|
||||
[
|
||||
'name' => IAccountManager::PROPERTY_FEDIVERSE,
|
||||
'value' => '@someMastodon@mastodon.social',
|
||||
'scope' => IAccountManager::SCOPE_PUBLISHED
|
||||
],
|
||||
[
|
||||
'name' => IAccountManager::PROPERTY_PHONE,
|
||||
'value' => '+491601231212',
|
||||
|
|
@ -211,6 +216,11 @@ class AccountManagerTest extends TestCase {
|
|||
'value' => '@a_alice',
|
||||
'scope' => IAccountManager::SCOPE_FEDERATED
|
||||
],
|
||||
[
|
||||
'name' => IAccountManager::PROPERTY_FEDIVERSE,
|
||||
'value' => '@a_alice@cool.social',
|
||||
'scope' => IAccountManager::SCOPE_FEDERATED
|
||||
],
|
||||
[
|
||||
'name' => IAccountManager::PROPERTY_PHONE,
|
||||
'value' => '+491602312121',
|
||||
|
|
@ -266,6 +276,11 @@ class AccountManagerTest extends TestCase {
|
|||
'value' => '',
|
||||
'scope' => IAccountManager::SCOPE_LOCAL
|
||||
],
|
||||
[
|
||||
'name' => IAccountManager::PROPERTY_FEDIVERSE,
|
||||
'value' => '',
|
||||
'scope' => IAccountManager::SCOPE_LOCAL
|
||||
],
|
||||
[
|
||||
'name' => IAccountManager::PROPERTY_PHONE,
|
||||
'value' => '+491603121212',
|
||||
|
|
@ -321,6 +336,11 @@ class AccountManagerTest extends TestCase {
|
|||
'value' => '', '
|
||||
scope' => IAccountManager::SCOPE_LOCAL
|
||||
],
|
||||
[
|
||||
'name' => IAccountManager::PROPERTY_FEDIVERSE,
|
||||
'value' => '', '
|
||||
scope' => IAccountManager::SCOPE_LOCAL
|
||||
],
|
||||
[
|
||||
'name' => IAccountManager::PROPERTY_PHONE,
|
||||
'value' => '+71601212123',
|
||||
|
|
@ -386,6 +406,11 @@ class AccountManagerTest extends TestCase {
|
|||
'value' => '',
|
||||
'scope' => IAccountManager::SCOPE_LOCAL
|
||||
],
|
||||
[
|
||||
'name' => IAccountManager::PROPERTY_FEDIVERSE,
|
||||
'value' => '',
|
||||
'scope' => IAccountManager::SCOPE_LOCAL
|
||||
],
|
||||
[
|
||||
'name' => IAccountManager::PROPERTY_PHONE,
|
||||
'value' => '+71602121231',
|
||||
|
|
@ -570,6 +595,13 @@ class AccountManagerTest extends TestCase {
|
|||
'verified' => IAccountManager::NOT_VERIFIED,
|
||||
],
|
||||
|
||||
[
|
||||
'name' => IAccountManager::PROPERTY_FEDIVERSE,
|
||||
'value' => '',
|
||||
'scope' => IAccountManager::SCOPE_LOCAL,
|
||||
'verified' => IAccountManager::NOT_VERIFIED,
|
||||
],
|
||||
|
||||
[
|
||||
'name' => IAccountManager::PROPERTY_ORGANISATION,
|
||||
'value' => '',
|
||||
|
|
@ -619,6 +651,12 @@ class AccountManagerTest extends TestCase {
|
|||
'verified' => IAccountManager::NOT_VERIFIED,
|
||||
'name' => IAccountManager::PROPERTY_TWITTER,
|
||||
],
|
||||
[
|
||||
'value' => '@mastohandle@mastodon.social',
|
||||
'scope' => IAccountManager::SCOPE_LOCAL,
|
||||
'verified' => IAccountManager::NOT_VERIFIED,
|
||||
'name' => IAccountManager::PROPERTY_FEDIVERSE,
|
||||
],
|
||||
[
|
||||
'value' => 'test@example.com',
|
||||
'scope' => IAccountManager::SCOPE_PUBLISHED,
|
||||
|
|
@ -634,6 +672,7 @@ class AccountManagerTest extends TestCase {
|
|||
];
|
||||
$expected = new Account($user);
|
||||
$expected->setProperty(IAccountManager::PROPERTY_TWITTER, '@twitterhandle', IAccountManager::SCOPE_LOCAL, IAccountManager::NOT_VERIFIED);
|
||||
$expected->setProperty(IAccountManager::PROPERTY_FEDIVERSE, '@mastohandle@mastodon.social', IAccountManager::SCOPE_LOCAL, IAccountManager::NOT_VERIFIED);
|
||||
$expected->setProperty(IAccountManager::PROPERTY_EMAIL, 'test@example.com', IAccountManager::SCOPE_PUBLISHED, IAccountManager::VERIFICATION_IN_PROGRESS);
|
||||
$expected->setProperty(IAccountManager::PROPERTY_WEBSITE, 'https://example.com', IAccountManager::SCOPE_FEDERATED, IAccountManager::VERIFIED);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue