aboutsummaryrefslogtreecommitdiffstats
path: root/apps/provisioning_api/tests
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-03-16 15:30:48 +0100
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-03-22 15:06:04 +0100
commit41b690ed53be36498607c13c2b8b3d84e240c84b (patch)
tree0c8b2f651af986e233cc6de46e6d1f5bc45c46dd /apps/provisioning_api/tests
parentf843b7edfe7b3bc6e45d4610778d2df98b3985e3 (diff)
downloadnextcloud-server-41b690ed53be36498607c13c2b8b3d84e240c84b.tar.gz
nextcloud-server-41b690ed53be36498607c13c2b8b3d84e240c84b.zip
Allow admin to create users withoutpassword by sending mail automatically
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/provisioning_api/tests')
-rw-r--r--apps/provisioning_api/tests/Controller/UsersControllerTest.php27
1 files changed, 17 insertions, 10 deletions
diff --git a/apps/provisioning_api/tests/Controller/UsersControllerTest.php b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
index 38e35988137..3f2cf3b1105 100644
--- a/apps/provisioning_api/tests/Controller/UsersControllerTest.php
+++ b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
@@ -56,6 +56,7 @@ use OCP\IUserManager;
use OCP\IUserSession;
use OCP\L10N\IFactory;
use OCP\Mail\IMailer;
+use OCP\Security\ISecureRandom;
use PHPUnit_Framework_MockObject_MockObject;
use Test\TestCase;
@@ -85,6 +86,8 @@ class UsersControllerTest extends TestCase {
private $newUserMailHelper;
/** @var FederatedFileSharingFactory|\PHPUnit_Framework_MockObject_MockObject */
private $federatedFileSharingFactory;
+ /** @var ISecureRandom|\PHPUnit_Framework_MockObject_MockObject */
+ private $secureRandom;
protected function setUp() {
parent::setUp();
@@ -100,6 +103,7 @@ class UsersControllerTest extends TestCase {
$this->l10nFactory = $this->createMock(IFactory::class);
$this->newUserMailHelper = $this->createMock(NewUserMailHelper::class);
$this->federatedFileSharingFactory = $this->createMock(FederatedFileSharingFactory::class);
+ $this->secureRandom = $this->createMock(ISecureRandom::class);
$this->api = $this->getMockBuilder(UsersController::class)
->setConstructorArgs([
@@ -114,7 +118,8 @@ class UsersControllerTest extends TestCase {
$this->logger,
$this->l10nFactory,
$this->newUserMailHelper,
- $this->federatedFileSharingFactory
+ $this->federatedFileSharingFactory,
+ $this->secureRandom
])
->setMethods(['fillStorageInfo'])
->getMock();
@@ -242,7 +247,7 @@ class UsersControllerTest extends TestCase {
->with('adminUser')
->willReturn(true);
- $this->api->addUser('AlreadyExistingUser', 'password', []);
+ $this->api->addUser('AlreadyExistingUser', 'password', '', []);
}
/**
@@ -278,7 +283,7 @@ class UsersControllerTest extends TestCase {
->with('NonExistingGroup')
->willReturn(false);
- $this->api->addUser('NewUser', 'pass', ['NonExistingGroup']);
+ $this->api->addUser('NewUser', 'pass', '', ['NonExistingGroup']);
}
/**
@@ -320,7 +325,7 @@ class UsersControllerTest extends TestCase {
['NonExistingGroup', false]
]));
- $this->api->addUser('NewUser', 'pass', ['ExistingGroup', 'NonExistingGroup']);
+ $this->api->addUser('NewUser', 'pass', '', ['ExistingGroup', 'NonExistingGroup']);
}
public function testAddUserSuccessful() {
@@ -412,7 +417,7 @@ class UsersControllerTest extends TestCase {
['Added userid NewUser to group ExistingGroup', ['app' => 'ocs_api']]
);
- $this->assertEquals([], $this->api->addUser('NewUser', 'PasswordOfTheNewUser', ['ExistingGroup'])->getData());
+ $this->assertEquals([], $this->api->addUser('NewUser', 'PasswordOfTheNewUser', '', ['ExistingGroup'])->getData());
}
/**
@@ -490,7 +495,7 @@ class UsersControllerTest extends TestCase {
->with()
->willReturn($subAdminManager);
- $this->api->addUser('NewUser', 'PasswordOfTheNewUser', []);
+ $this->api->addUser('NewUser', 'PasswordOfTheNewUser', '', []);
}
/**
@@ -539,7 +544,7 @@ class UsersControllerTest extends TestCase {
->with('ExistingGroup')
->willReturn(true);
- $this->api->addUser('NewUser', 'PasswordOfTheNewUser', ['ExistingGroup'])->getData();
+ $this->api->addUser('NewUser', 'PasswordOfTheNewUser', '', ['ExistingGroup'])->getData();
}
public function testAddUserAsSubAdminExistingGroups() {
@@ -630,7 +635,7 @@ class UsersControllerTest extends TestCase {
)
->willReturn(true);
- $this->assertEquals([], $this->api->addUser('NewUser', 'PasswordOfTheNewUser', ['ExistingGroup1', 'ExistingGroup2'])->getData());
+ $this->assertEquals([], $this->api->addUser('NewUser', 'PasswordOfTheNewUser', '', ['ExistingGroup1', 'ExistingGroup2'])->getData());
}
/**
@@ -2928,7 +2933,8 @@ class UsersControllerTest extends TestCase {
$this->logger,
$this->l10nFactory,
$this->newUserMailHelper,
- $this->federatedFileSharingFactory
+ $this->federatedFileSharingFactory,
+ $this->secureRandom
])
->setMethods(['getUserData'])
->getMock();
@@ -2990,7 +2996,8 @@ class UsersControllerTest extends TestCase {
$this->logger,
$this->l10nFactory,
$this->newUserMailHelper,
- $this->federatedFileSharingFactory
+ $this->federatedFileSharingFactory,
+ $this->secureRandom
])
->setMethods(['getUserData'])
->getMock();