Ejemplo n.º 1
0
 public function setUp()
 {
     $bootstrap = parse_ini_file(dirname(__FILE__) . '/test.properties');
     $this->jc = new JasperClient($bootstrap['hostname'], $bootstrap['port'], $bootstrap['admin_username'], $bootstrap['admin_password'], $bootstrap['base_url'], $bootstrap['admin_org']);
     $this->newUser = JasperTestUtils::createUser();
     $this->newRole = new Role('NOT_A_REAL_ROLE', 'organization_1');
     $this->jc->putUsers($this->newUser);
 }
Ejemplo n.º 2
0
 /**
  * Checks if user's attributes are saved correctly when postAttributes() is called with an array of Attributes, that is
  * multiple Attributes.
  */
 public function testPostAttributes_addsMultipleAttributesCount()
 {
     $this->jc->putUsers($this->newUser);
     $attrCount = count($this->jc->getAttributes($this->newUser));
     $this->jc->postAttributes($this->newUser, $this->attrArr);
     $attr2Value = $this->jc->getAttributes($this->newUser);
     $newCount = count($attr2Value);
     $this->jc->deleteUser($this->newUser);
     $this->assertEquals($attrCount + 2, $newCount);
     $this->assertEquals('Anchor Steam', $attr2Value[1]->getAttrValue());
 }
Ejemplo n.º 3
0
 /**
  * Checks delRole() by actually deleting a Role from User.
  */
 public function testRevokingARole_actuallyRevokesARole()
 {
     $user = JasperTestUtils::createUser();
     $role = new Role('ROLE_DEMO', null, 'false');
     $user->addRole($role);
     $this->jc->putUsers($user);
     $createdUser = $this->jc->getUsers($user->getUsername());
     $createdUser = $createdUser[0];
     $this->assertEquals(count($user->getRoles()), count($createdUser->getRoles()));
     $user->delRole($role);
     $this->jc->postUser($user);
     $updatedUser = $this->jc->getUsers($user->getUsername());
     $updatedUser = $updatedUser[0];
     $this->jc->deleteUser($user);
     $this->assertEquals(count($user->getRoles()), count($updatedUser->getRoles()));
     $this->assertEquals(count($createdUser->getRoles()) - 1, count($updatedUser->getRoles()));
 }