aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2024-09-18 11:38:44 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2024-09-18 13:30:33 +0200
commit8fb64b886ad05ace70b9485ec36b6f778dc01925 (patch)
treee471f457c539656c7d7ea2dbe5769d72c6675645 /apps
parentcd3256bf5445c4f2b20af345ab48485f21a45bfe (diff)
downloadnextcloud-server-8fb64b886ad05ace70b9485ec36b6f778dc01925.tar.gz
nextcloud-server-8fb64b886ad05ace70b9485ec36b6f778dc01925.zip
fix(settings): pronouns UsersControllerTest
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps')
-rw-r--r--apps/settings/tests/Controller/UsersControllerTest.php61
-rw-r--r--apps/settings/tests/UserMigration/assets/account-complex-config.json2
-rw-r--r--apps/settings/tests/UserMigration/assets/account-complex.json2
-rw-r--r--apps/settings/tests/UserMigration/assets/account-config.json2
-rw-r--r--apps/settings/tests/UserMigration/assets/account.json2
5 files changed, 60 insertions, 9 deletions
diff --git a/apps/settings/tests/Controller/UsersControllerTest.php b/apps/settings/tests/Controller/UsersControllerTest.php
index db346ab89f2..e8ae965b3bb 100644
--- a/apps/settings/tests/Controller/UsersControllerTest.php
+++ b/apps/settings/tests/Controller/UsersControllerTest.php
@@ -224,6 +224,11 @@ class UsersControllerTest extends \Test\TestCase {
'Default birthdate',
IAccountManager::SCOPE_LOCAL,
),
+ IAccountManager::PROPERTY_PRONOUNS => $this->buildPropertyMock(
+ IAccountManager::PROPERTY_PRONOUNS,
+ 'Default pronouns',
+ IAccountManager::SCOPE_LOCAL,
+ ),
];
$account = $this->createMock(IAccount::class);
@@ -275,7 +280,7 @@ class UsersControllerTest extends \Test\TestCase {
$controller->expects($this->never())->method('saveUserSettings');
}
- $result = $controller->setUserSettings(//
+ $result = $controller->setUserSettings(
AccountManager::SCOPE_FEDERATED,
'displayName',
AccountManager::SCOPE_FEDERATED,
@@ -288,7 +293,13 @@ class UsersControllerTest extends \Test\TestCase {
'street and city',
AccountManager::SCOPE_FEDERATED,
'@nextclouders',
- AccountManager::SCOPE_FEDERATED
+ AccountManager::SCOPE_FEDERATED,
+ '@nextclouders',
+ AccountManager::SCOPE_FEDERATED,
+ '2020-01-01',
+ AccountManager::SCOPE_FEDERATED,
+ 'they/them',
+ AccountManager::SCOPE_FEDERATED,
);
$this->assertSame($expectedStatus, $result->getStatus());
@@ -321,6 +332,10 @@ class UsersControllerTest extends \Test\TestCase {
$twitterScope = IAccountManager::SCOPE_PUBLISHED;
$fediverse = '@nextclouders@floss.social';
$fediverseScope = IAccountManager::SCOPE_PUBLISHED;
+ $birtdate = '2020-01-01';
+ $birthdateScope = IAccountManager::SCOPE_PUBLISHED;
+ $pronouns = 'she/her';
+ $pronounsScope = IAccountManager::SCOPE_PUBLISHED;
$user = $this->createMock(IUser::class);
$user->method('getUID')->willReturn('johndoe');
@@ -397,7 +412,11 @@ class UsersControllerTest extends \Test\TestCase {
$twitter,
$twitterScope,
$fediverse,
- $fediverseScope
+ $fediverseScope,
+ $birtdate,
+ $birthdateScope,
+ $pronouns,
+ $pronounsScope,
);
}
@@ -436,6 +455,10 @@ class UsersControllerTest extends \Test\TestCase {
$twitterScope = IAccountManager::SCOPE_PUBLISHED;
$fediverse = '@nextclouders@floss.social';
$fediverseScope = IAccountManager::SCOPE_PUBLISHED;
+ $birthdate = '2020-01-01';
+ $birthdateScope = IAccountManager::SCOPE_PUBLISHED;
+ $pronouns = 'she/her';
+ $pronounsScope = IAccountManager::SCOPE_PUBLISHED;
// All settings are changed (in the past phone, website, address and
// twitter were not changed).
@@ -455,6 +478,10 @@ class UsersControllerTest extends \Test\TestCase {
$expectedProperties[IAccountManager::PROPERTY_TWITTER]['scope'] = $twitterScope;
$expectedProperties[IAccountManager::PROPERTY_FEDIVERSE]['value'] = $fediverse;
$expectedProperties[IAccountManager::PROPERTY_FEDIVERSE]['scope'] = $fediverseScope;
+ $expectedProperties[IAccountManager::PROPERTY_BIRTHDATE]['value'] = $birthdate;
+ $expectedProperties[IAccountManager::PROPERTY_BIRTHDATE]['scope'] = $birthdateScope;
+ $expectedProperties[IAccountManager::PROPERTY_PRONOUNS]['value'] = $pronouns;
+ $expectedProperties[IAccountManager::PROPERTY_PRONOUNS]['scope'] = $pronounsScope;
$this->mailer->expects($this->once())->method('validateMailAddress')
->willReturn(true);
@@ -478,7 +505,11 @@ class UsersControllerTest extends \Test\TestCase {
$twitter,
$twitterScope,
$fediverse,
- $fediverseScope
+ $fediverseScope,
+ $birthdate,
+ $birthdateScope,
+ $pronouns,
+ $pronounsScope,
);
}
@@ -518,6 +549,10 @@ class UsersControllerTest extends \Test\TestCase {
$twitterScope = ($property === 'twitterScope') ? $propertyValue : null;
$fediverse = ($property === 'fediverse') ? $propertyValue : null;
$fediverseScope = ($property === 'fediverseScope') ? $propertyValue : null;
+ $birthdate = ($property === 'birthdate') ? $propertyValue : null;
+ $birthdateScope = ($property === 'birthdateScope') ? $propertyValue : null;
+ $pronouns = ($property === 'pronouns') ? $propertyValue : null;
+ $pronounsScope = ($property === 'pronounsScope') ? $propertyValue : null;
/** @var IAccountProperty[]|MockObject[] $expectedProperties */
$expectedProperties = $userAccount->getProperties();
@@ -554,6 +589,14 @@ class UsersControllerTest extends \Test\TestCase {
case 'fediverseScope':
$propertyId = IAccountManager::PROPERTY_FEDIVERSE;
break;
+ case 'birthdate':
+ case 'birthdateScope':
+ $propertyId = IAccountManager::PROPERTY_BIRTHDATE;
+ break;
+ case 'pronouns':
+ case 'pronounsScope':
+ $propertyId = IAccountManager::PROPERTY_PRONOUNS;
+ break;
default:
$propertyId = '404';
}
@@ -585,7 +628,11 @@ class UsersControllerTest extends \Test\TestCase {
$twitter,
$twitterScope,
$fediverse,
- $fediverseScope
+ $fediverseScope,
+ $birthdate,
+ $birthdateScope,
+ $pronouns,
+ $pronounsScope,
);
}
@@ -606,6 +653,10 @@ class UsersControllerTest extends \Test\TestCase {
['twitterScope', IAccountManager::SCOPE_PUBLISHED],
['fediverse', '@nextclouders@floss.social'],
['fediverseScope', IAccountManager::SCOPE_PUBLISHED],
+ ['birthdate', '2020-01-01'],
+ ['birthdateScope', IAccountManager::SCOPE_PUBLISHED],
+ ['pronouns', 'he/him'],
+ ['pronounsScope', IAccountManager::SCOPE_PUBLISHED],
];
}
diff --git a/apps/settings/tests/UserMigration/assets/account-complex-config.json b/apps/settings/tests/UserMigration/assets/account-complex-config.json
index 57c037a9d0d..fecf819057c 100644
--- a/apps/settings/tests/UserMigration/assets/account-complex-config.json
+++ b/apps/settings/tests/UserMigration/assets/account-complex-config.json
@@ -1 +1 @@
-{"address":{"visibility":"show_users_only"},"avatar":{"visibility":"show_users_only"},"biography":{"visibility":"show"},"displayname":{"visibility":"show"},"fediverse":{"visibility":"show_users_only"},"headline":{"visibility":"show"},"organisation":{"visibility":"show"},"role":{"visibility":"show"},"email":{"visibility":"hide"},"phone":{"visibility":"hide"},"twitter":{"visibility":"show_users_only"},"website":{"visibility":"show_users_only"},"talk":{"visibility":"show"}} \ No newline at end of file
+{"address":{"visibility":"show_users_only"},"avatar":{"visibility":"show_users_only"},"biography":{"visibility":"show"},"displayname":{"visibility":"show"},"fediverse":{"visibility":"show_users_only"},"headline":{"visibility":"show"},"organisation":{"visibility":"show"},"role":{"visibility":"show"},"email":{"visibility":"hide"},"phone":{"visibility":"hide"},"twitter":{"visibility":"show_users_only"},"website":{"visibility":"show_users_only"},"talk":{"visibility":"show"},"birthdate":{"visibility":"show_users_only"},"pronouns":{"visibility":"show"}} \ No newline at end of file
diff --git a/apps/settings/tests/UserMigration/assets/account-complex.json b/apps/settings/tests/UserMigration/assets/account-complex.json
index 891f122f535..819ce0e7da4 100644
--- a/apps/settings/tests/UserMigration/assets/account-complex.json
+++ b/apps/settings/tests/UserMigration/assets/account-complex.json
@@ -1 +1 @@
-{"displayname":{"name":"displayname","value":"Steve Smith","scope":"v2-local","verified":"0","verificationData":""},"address":{"name":"address","value":"123 Water St","scope":"v2-local","verified":"0","verificationData":""},"website":{"name":"website","value":"https:\/\/example.org","scope":"v2-local","verified":"0","verificationData":""},"email":{"name":"email","value":"steve@example.org","scope":"v2-federated","verified":"1","verificationData":""},"avatar":{"name":"avatar","value":"","scope":"v2-local","verified":"0","verificationData":""},"phone":{"name":"phone","value":"+12178515387","scope":"v2-private","verified":"0","verificationData":""},"twitter":{"name":"twitter","value":"steve","scope":"v2-federated","verified":"0","verificationData":""},"fediverse":{"name":"fediverse","value":"@steve@floss.social","scope":"v2-federated","verified":"0","verificationData":""},"organisation":{"name":"organisation","value":"Mytery Machine","scope":"v2-private","verified":"0","verificationData":""},"role":{"name":"role","value":"Manager","scope":"v2-private","verified":"0","verificationData":""},"headline":{"name":"headline","value":"I am Steve","scope":"v2-local","verified":"0","verificationData":""},"biography":{"name":"biography","value":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris porttitor ullamcorper dictum. Sed fermentum ut ligula scelerisque semper. Aliquam interdum convallis tellus eu dapibus. Integer in justo sollicitudin, hendrerit ligula sit amet, blandit sem.\n\nSuspendisse consectetur ultrices accumsan. Quisque sagittis bibendum lectus ut placerat. Mauris tincidunt ornare neque, et pulvinar tortor porttitor eu.","scope":"v2-local","verified":"0","verificationData":""},"birthdate":{"name":"birthdate","value":"","scope":"v2-local","verified":"0","verificationData":""},"profile_enabled":{"name":"profile_enabled","value":"1","scope":"v2-local","verified":"0","verificationData":""},"additional_mail":[{"name":"additional_mail","value":"steve@example.com","scope":"v2-published","verified":"0","verificationData":""},{"name":"additional_mail","value":"steve@earth.world","scope":"v2-local","verified":"0","verificationData":""}]} \ No newline at end of file
+{"displayname":{"name":"displayname","value":"Steve Smith","scope":"v2-local","verified":"0","verificationData":""},"address":{"name":"address","value":"123 Water St","scope":"v2-local","verified":"0","verificationData":""},"website":{"name":"website","value":"https://example.org","scope":"v2-local","verified":"0","verificationData":""},"email":{"name":"email","value":"steve@example.org","scope":"v2-federated","verified":"1","verificationData":""},"avatar":{"name":"avatar","value":"","scope":"v2-local","verified":"0","verificationData":""},"phone":{"name":"phone","value":"+12178515387","scope":"v2-private","verified":"0","verificationData":""},"twitter":{"name":"twitter","value":"steve","scope":"v2-federated","verified":"0","verificationData":""},"fediverse":{"name":"fediverse","value":"@steve@floss.social","scope":"v2-federated","verified":"0","verificationData":""},"organisation":{"name":"organisation","value":"Mytery Machine","scope":"v2-private","verified":"0","verificationData":""},"role":{"name":"role","value":"Manager","scope":"v2-private","verified":"0","verificationData":""},"headline":{"name":"headline","value":"I am Steve","scope":"v2-local","verified":"0","verificationData":""},"biography":{"name":"biography","value":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris porttitor ullamcorper dictum. Sed fermentum ut ligula scelerisque semper. Aliquam interdum convallis tellus eu dapibus. Integer in justo sollicitudin, hendrerit ligula sit amet, blandit sem.\n\nSuspendisse consectetur ultrices accumsan. Quisque sagittis bibendum lectus ut placerat. Mauris tincidunt ornare neque, et pulvinar tortor porttitor eu.","scope":"v2-local","verified":"0","verificationData":""},"birthdate":{"name":"birthdate","value":"","scope":"v2-local","verified":"0","verificationData":""},"profile_enabled":{"name":"profile_enabled","value":"1","scope":"v2-local","verified":"0","verificationData":""},"pronouns":{"name":"pronouns","value":"they/them","scope":"v2-local","verified":"0","verificationData":""},"additional_mail":[{"name":"additional_mail","value":"steve@example.com","scope":"v2-published","verified":"0","verificationData":""},{"name":"additional_mail","value":"steve@earth.world","scope":"v2-local","verified":"0","verificationData":""}]} \ No newline at end of file
diff --git a/apps/settings/tests/UserMigration/assets/account-config.json b/apps/settings/tests/UserMigration/assets/account-config.json
index 442857ced34..a1250fab8e9 100644
--- a/apps/settings/tests/UserMigration/assets/account-config.json
+++ b/apps/settings/tests/UserMigration/assets/account-config.json
@@ -1 +1 @@
-{"address":{"visibility":"show_users_only"},"avatar":{"visibility":"show"},"biography":{"visibility":"show"},"displayname":{"visibility":"show"},"fediverse":{"visibility":"show"},"headline":{"visibility":"show"},"organisation":{"visibility":"show"},"role":{"visibility":"show"},"email":{"visibility":"show_users_only"},"phone":{"visibility":"show_users_only"},"twitter":{"visibility":"show"},"website":{"visibility":"show"}} \ No newline at end of file
+{"address":{"visibility":"show_users_only"},"avatar":{"visibility":"show"},"biography":{"visibility":"show"},"displayname":{"visibility":"show"},"fediverse":{"visibility":"show"},"headline":{"visibility":"show"},"organisation":{"visibility":"show"},"role":{"visibility":"show"},"email":{"visibility":"show_users_only"},"phone":{"visibility":"show_users_only"},"twitter":{"visibility":"show"},"website":{"visibility":"show"},"birthdate":{"visibility":"show"},"pronouns":{"visibility":"show"}} \ No newline at end of file
diff --git a/apps/settings/tests/UserMigration/assets/account.json b/apps/settings/tests/UserMigration/assets/account.json
index 4bcbd8bc4f3..6bdc3c72d47 100644
--- a/apps/settings/tests/UserMigration/assets/account.json
+++ b/apps/settings/tests/UserMigration/assets/account.json
@@ -1 +1 @@
-{"displayname":{"name":"displayname","value":"Emma Jones","scope":"v2-federated","verified":"0","verificationData":""},"address":{"name":"address","value":"920 Grass St","scope":"v2-local","verified":"0","verificationData":""},"website":{"name":"website","value":"","scope":"v2-local","verified":"0","verificationData":""},"email":{"name":"email","value":"","scope":"v2-federated","verified":"1","verificationData":""},"avatar":{"name":"avatar","value":"","scope":"v2-federated","verified":"0","verificationData":""},"phone":{"name":"phone","value":"","scope":"v2-local","verified":"0","verificationData":""},"twitter":{"name":"twitter","value":"","scope":"v2-local","verified":"0","verificationData":""},"fediverse":{"name":"fediverse","value":"","scope":"v2-local","verified":"0","verificationData":""},"organisation":{"name":"organisation","value":"","scope":"v2-local","verified":"0","verificationData":""},"role":{"name":"role","value":"","scope":"v2-local","verified":"0","verificationData":""},"headline":{"name":"headline","value":"","scope":"v2-local","verified":"0","verificationData":""},"biography":{"name":"biography","value":"","scope":"v2-local","verified":"0","verificationData":""},"birthdate":{"name":"birthdate","value":"","scope":"v2-local","verified":"0","verificationData":""},"profile_enabled":{"name":"profile_enabled","value":"1","scope":"v2-local","verified":"0","verificationData":""},"additional_mail":[]} \ No newline at end of file
+{"displayname":{"name":"displayname","value":"Emma Jones","scope":"v2-federated","verified":"0","verificationData":""},"address":{"name":"address","value":"920 Grass St","scope":"v2-local","verified":"0","verificationData":""},"website":{"name":"website","value":"","scope":"v2-local","verified":"0","verificationData":""},"email":{"name":"email","value":"","scope":"v2-federated","verified":"1","verificationData":""},"avatar":{"name":"avatar","value":"","scope":"v2-federated","verified":"0","verificationData":""},"phone":{"name":"phone","value":"","scope":"v2-local","verified":"0","verificationData":""},"twitter":{"name":"twitter","value":"","scope":"v2-local","verified":"0","verificationData":""},"fediverse":{"name":"fediverse","value":"","scope":"v2-local","verified":"0","verificationData":""},"organisation":{"name":"organisation","value":"","scope":"v2-local","verified":"0","verificationData":""},"role":{"name":"role","value":"","scope":"v2-local","verified":"0","verificationData":""},"headline":{"name":"headline","value":"","scope":"v2-local","verified":"0","verificationData":""},"biography":{"name":"biography","value":"","scope":"v2-local","verified":"0","verificationData":""},"birthdate":{"name":"birthdate","value":"","scope":"v2-local","verified":"0","verificationData":""},"profile_enabled":{"name":"profile_enabled","value":"1","scope":"v2-local","verified":"0","verificationData":""},"pronouns":{"name":"pronouns","value":"","scope":"v2-federated","verified":"0","verificationData":""},"additional_mail":[]} \ No newline at end of file