public function testDelete1() { $request = array('delete' => array('username' => 'u1')); $this->env->setRequest($request)->setArguments(array('delete'))->setEvents(array(array('user-delete', array('u1'))))->setCommand('|^/usr/bin/id|', 0); $this->env->getDatabase('configuration')->setFinal(); $ac = $this->env->getDatabase('accounts'); $ac->transition($ac::setType('u1', 'user-deleted'), TRUE)->transition($ac::deleteKey('u1'), TRUE)->setFinal(); $this->runModuleTest($this->module, $this->env); }
public function testDelete() { $env = new \Test\Tool\ModuleTestEnvironment(); $env->setArguments(array('delete')); $env->setRequest(array('delete' => array('address' => '10.0.0.0'))); $cs = new \Test\Tool\MockState(); $cs->set(\Test\Tool\DB::getProp('httpd-admin', 'ValidFrom'), '192.168.1.0/255.255.255.0,10.0.0.0/255.128.0.0')->transition(\Test\Tool\DB::setProp('httpd-admin', 'ValidFrom', '192.168.1.0/255.255.255.0'), TRUE)->setFinal(); $env->setDatabase('configuration', $cs); $env->setEvents(array('remoteaccess-update')); $this->runModuleTest($this->object, $env); }
public function testDisablePassword() { $env = new \Test\Tool\ModuleTestEnvironment(); $env->setRequest(array('status' => 'anyNetwork', 'acceptPasswordFromAnyNetwork' => '')); $env->setView(array('status' => 'anyNetwork', 'acceptPasswordFromAnyNetwork' => '')); $cs = new \Test\Tool\MockState(); $cs->set(DB::getProp('ftp', 'status'), 'enabled'); $cs->set(DB::getProp('ftp', 'LoginAccess'), 'public'); $cs->set(DB::getProp('ftp', 'access'), 'public'); $cs->transition(DB::setProp('ftp', 'access', 'private'), TRUE)->setFinal(); $env->setDatabase('configuration', $cs); $env->setEvents(array('remoteaccess-update')); $this->runModuleTest($this->object, $env); }
public function testChangePassword1() { $request = array('newPassword' => 'password', 'confirmPassword' => 'password'); $this->env->setRequest($request)->setArguments(array('username'))->setEvents(array(array('password-modify', array('username', '/file/path')))); $this->runModuleTest($this->module, $this->env); }
public function environmentProvider() { $env1 = new \Test\Tool\ModuleTestEnvironment(); $env1->setCommands(array('|^/bin/date|' => '2010|12|31|12|00|30', '|^/usr/bin/find|' => strtr("%{PREFIX}Europe/Rome\n%{PREFIX}Europe/Berlin\n", array('%{PREFIX}' => \NethServer\Module\DateTime::ZONEINFO_DIR)), '|^/usr/bin/readlink|' => \NethServer\Module\DateTime::ZONEINFO_DIR . 'Europe/Rome')); return array(array($env1)); }