Skip to content

Commit

Permalink
SOAP tests: add case for private project lockout
Browse files Browse the repository at this point in the history
Issue #16554
  • Loading branch information
dregad committed Feb 4, 2014
1 parent a688c73 commit c4bae10
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tests/soap/ProjectTest.php
Expand Up @@ -113,6 +113,44 @@ public function testGetSubprojects() {
$this->assertEquals(0, count($projectsArray));
}

/**
* A test case which validates that managers do not lock themselves out when
* making a project Private.
*
* 1. Create a project
* 2. Create a test manager user (currently not implemented, see below)
* 3. Set project view state to private
* 4. Ensure user can still access the project
*
* @TODO for this to be a truly useful test case, the project update should
* actually be performed by a user with MANAGER role. However since the SOAP
* API does not provide user administration functions, it is currently not
* possible to properly implement this test.
*/
public function testSetProjectPrivateLockout() {
$projectDataStructure = $this->newProjectAsArray( $this->getName() . "_" . rand() );

# step 1
$projectId = $this->client->mc_project_add( $this->userName, $this->password, $projectDataStructure );
$this->projectIdToDelete[] = $projectId;

# step 3
$projectDataStructure['view_state'] = array( 'id' => VS_PRIVATE );
$updateOk = $this->client->mc_project_update( $this->userName, $this->password, $projectId, $projectDataStructure );
$this->assertTrue( $updateOk, "Project update failed");

# step 4
$projList = $this->client->mc_projects_get_user_accessible( $this->userName, $this->password );
$found = false;
foreach( $projList as $proj ) {
if( $projectId == $proj->id ) {
$found = true;
break;
}
}
$this->assertTrue( $found, "User '$this->userName' no longer has access to the project" );
}

/**
* New project Array
*/
Expand Down

0 comments on commit c4bae10

Please sign in to comment.