示例#1
0
 public function testLoginByCookie()
 {
     $email = '*****@*****.**';
     $cookie_dao = DAOFactory::getDao('CookieDAO');
     $cookie = $cookie_dao->generateForEmail($email);
     $this->get($this->url . '/index.php');
     $this->assertNoText($email);
     $this->getBrowser()->setCookie(Session::COOKIE_NAME, $cookie);
     $this->get($this->url . '/index.php');
     $this->assertText($email);
 }
示例#2
0
 public function testLoginSuccessAndPrivateDashboard()
 {
     $email = '*****@*****.**';
     $cookie_dao = DAOFactory::getDao('CookieDAO');
     $deleted = $cookie_dao->deleteByEmail($email);
     $this->assertFalse($deleted);
     $this->get($this->url . '/session/login.php');
     $this->setField('email', $email);
     $this->setField('pwd', 'secretpassword');
     $this->click("Log In");
     $this->get($this->url . '/dashboard.php');
     $this->assertTitle("thinkupapp's Dashboard | " . Config::getInstance()->getValue('app_title_prefix') . "ThinkUp");
     $this->assertText('Logged in as admin: ' . $email);
     $cookie = $this->getBrowser()->getCurrentCookieValue(Session::COOKIE_NAME);
     $deleted = $cookie_dao->deleteByEmail($email);
     $this->assertTrue($deleted);
 }
 public function testDeleteInstance()
 {
     $email = '*****@*****.**';
     $cookie_dao = DAOFactory::getDao('CookieDAO');
     $cookie = $cookie_dao->generateForEmail($email);
     $this->get($this->url . '/index.php');
     $this->assertNoText($email);
     $this->getBrowser()->setCookie(Session::COOKIE_NAME, $cookie);
     $this->get($this->url . '/index.php');
     $this->assertText($email);
     $this->click("Settings");
     $this->get($this->url . '/account/index.php?p=twitter#manage_plugin');
     $this->assertLink('@ev');
     $this->assertLink('@thinkupapp');
     $this->assertLink('@linkbaiter');
     $this->assertLink('@shutterbug');
     $this->assertPattern('/Remove an account/');
     //delete existing instance
     $this->post($this->url . '/account/index.php?p=twitter', array('action' => 'Delete', 'instance_id' => '3', 'csrf_token' => self::TEST_CSRF_TOKEN));
     $this->assertPattern("/Account deleted\\./");
     $this->assertLink('@thinkupapp');
     $this->assertLink('@linkbaiter');
     $this->assertNoLink('@shutterbug');
     $this->assertPattern('/Remove an account/');
     //delete non-existent instance
     $this->post($this->url . '/account/index.php?p=twitter', array('action' => 'Delete', 'instance_id' => '231', 'csrf_token' => self::TEST_CSRF_TOKEN));
     $this->assertPattern("/Could not find that account\\./");
     $this->assertLink('@thinkupapp');
     $this->assertLink('@linkbaiter');
     $this->assertPattern('/Remove an account/');
     $this->click('Log out');
     //        $this->assertText('You have successfully logged out');
     //        $this->showSource();
     $this->assertText("Log in");
     $this->get($this->url . '/session/login.php');
     $this->setField('email', '*****@*****.**');
     $this->setField('pwd', 'secretpassword');
     $this->click("Log In");
     //delete instance with no privileges
     $this->post($this->url . '/account/index.php?p=twitter', array('action' => 'Delete', 'instance_id' => '2', 'csrf_token' => self::TEST_CSRF_TOKEN));
     $this->assertPattern("/Insufficient privileges\\./");
 }
示例#4
0
 public function testLogout()
 {
     $email = '*****@*****.**';
     $cookie_dao = DAOFactory::getDao('CookieDAO');
     $deleted = $cookie_dao->deleteByEmail($email);
     $this->assertFalse($deleted);
     $this->get($this->url . '/session/login.php');
     $this->setField('email', $email);
     $this->setField('pwd', 'secretpassword');
     $this->click("Log In");
     $this->get($this->url . '/index.php');
     $this->assertTitle(Config::getInstance()->getValue('app_title_prefix') . "ThinkUp");
     $this->assertText($email);
     $cookie = $this->getBrowser()->getCurrentCookieValue(Session::COOKIE_NAME);
     $this->get($this->url . '/session/logout.php');
     $cookie = $this->getBrowser()->getCurrentCookieValue(Session::COOKIE_NAME);
     $this->assertEqual('deleted', $cookie);
     $this->get($this->url . '/index.php');
     $this->assertNoText($email);
     $deleted = $cookie_dao->deleteByEmail($email);
     $this->assertFalse($deleted);
 }