Skip to content

Commit 40da2a9

Browse files
committed
test: add acceptance test for when the subadmin feature is disabled
1 parent f07c6ed commit 40da2a9

2 files changed

Lines changed: 41 additions & 4 deletions

File tree

tests/acceptance/features/apiProvisioning-v1/createSubAdmin.feature

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ Feature: create a subadmin
2525
And the HTTP status code should be "200"
2626
And user "nonexistentuser" should not be a subadmin of group "brand-new-group"
2727

28+
@smokeTest
29+
Scenario: admin tries to create a subadmin when the subadmin feature is disabled
30+
Given user "brand-new-user" has been created with default attributes and without skeleton files
31+
And group "brand-new-group" has been created
32+
When the administrator tries to make user "brand-new-user" a subadmin of group "brand-new-group" using the provisioning API with the subadmin feature disabled
33+
Then the OCS status code should be "103"
34+
And the HTTP status code should be "200"
35+
And user "brand-new-user" should not be a subadmin of group "brand-new-group"
36+
2837

2938
Scenario: admin tries to create a subadmin using a group which does not exist
3039
Given user "brand-new-user" has been created with default attributes and without skeleton files

tests/acceptance/features/bootstrap/Provisioning.php

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4253,24 +4253,52 @@ public function adminMakesUserSubadminOfGroupUsingTheProvisioningApi(
42534253
);
42544254
}
42554255

4256+
/**
4257+
* @When /^the administrator tries to make user "([^"]*)" a subadmin of group "([^"]*)" using the provisioning API with the subadmin feature disabled$/
4258+
*
4259+
* @param string $user
4260+
* @param string $group
4261+
*
4262+
* @return void
4263+
*/
4264+
public function adminTriesToMakeUserSubadminOfGroupUsingTheProvisioningApiWithSubadminFeatureDisabled(
4265+
string $user,
4266+
string $group
4267+
):void {
4268+
$user = $this->getActualUsername($user);
4269+
$this->userMakesUserASubadminOfGroupUsingTheProvisioningApi(
4270+
$this->getAdminUsername(),
4271+
$user,
4272+
$group,
4273+
false
4274+
);
4275+
}
4276+
42564277
/**
42574278
* @When user :user makes user :otherUser a subadmin of group :group using the provisioning API
42584279
*
42594280
* @param string $user
42604281
* @param string $otherUser
42614282
* @param string $group
4283+
* @param bool $enableSubadminFeature
42624284
*
42634285
* @return void
42644286
* @throws Exception
42654287
*/
42664288
public function userMakesUserASubadminOfGroupUsingTheProvisioningApi(
42674289
string $user,
42684290
string $otherUser,
4269-
string $group
4291+
string $group,
4292+
bool $enableSubadminFeature = true
42704293
):void {
4271-
// The subadmin feature is disabled by default; enable it so these
4272-
// scenarios can exercise it. Reverted in cleanupSubadminFeature().
4273-
$this->enableSubadminFeature();
4294+
if ($enableSubadminFeature) {
4295+
// The subadmin feature is disabled by default; enable it so these
4296+
// scenarios can exercise it. Reverted in cleanupSubadminFeature().
4297+
$this->enableSubadminFeature();
4298+
} else {
4299+
// Make sure that the Subadmin feature is disabled.
4300+
$this->cleanupSubadminFeature();
4301+
}
42744302
$actualUser = $this->getActualUsername($user);
42754303
$actualPassword = $this->getUserPassword($actualUser);
42764304
$actualSubadminUsername = $this->getActualUsername($otherUser);

0 commit comments

Comments
 (0)