コード例 #1
0
 public function testSuccessfulLogin()
 {
     $hashed_pass = ThinkUpTestLoginHelper::hashPasswordUsingCurrentMethod('mypassword', 'test');
     $builder = FixtureBuilder::build('owners', array('id' => 1, 'email' => '*****@*****.**', 'pwd' => $hashed_pass, 'pwd_salt' => 'test', 'is_activated' => 1, 'is_admin' => 1));
     //CLI
     $controller = new StreamerAuthController(2, array('stream', '*****@*****.**', 'mypassword'));
     $this->assertTrue(isset($controller));
     $results = $controller->go();
     $this->debug($results);
     $this->assertNoPattern('/ERROR: Invalid or missing username and password./', $results);
 }
コード例 #2
0
 protected function buildData()
 {
     $builders = array();
     $salt = 'salt';
     $pwd1 = ThinkUpTestLoginHelper::hashPasswordUsingDeprecatedMethod('pwd1');
     $pwd2 = ThinkUpTestLoginHelper::hashPasswordUsingDeprecatedMethod('pwd2');
     $pwd3 = ThinkUpTestLoginHelper::hashPasswordUsingCurrentMethod('pwd3', $salt);
     $builders[] = FixtureBuilder::build('owners', array('full_name' => 'ThinkUp J. User', 'email' => '*****@*****.**', 'is_activated' => 0, 'pwd' => $pwd1, 'pwd_salt' => OwnerMySQLDAO::$default_salt, 'activation_code' => '8888', 'account_status' => '', 'api_key' => 'c9089f3c9adaf0186f6ffb1ee8d6501c', 'joined' => '1978-03-22', 'email_notification_frequency' => 'both', 'timezone' => 'UTC', 'membership_level' => 'Member'));
     $builders[] = FixtureBuilder::build('owners', array('full_name' => 'ThinkUp J. User1', 'email' => '*****@*****.**', 'is_activated' => 1, 'pwd' => $pwd2, 'pwd_salt' => OwnerMySQLDAO::$default_salt, 'account_status' => '', 'email_notification_frequency' => 'never'));
     $builders[] = FixtureBuilder::build('owners', array('full_name' => 'Salted User', 'email' => '*****@*****.**', 'is_activated' => 1, 'pwd' => $pwd3, 'pwd_salt' => $salt, 'account_status' => '', 'email_notification_frequency' => 'both'));
     return $builders;
 }
コード例 #3
0
 protected function buildData()
 {
     $builders = array();
     $hashed_pass = ThinkUpTestLoginHelper::hashPasswordUsingDeprecatedMethod("secretpassword");
     $builders[] = FixtureBuilder::build('owners', array('id' => 1, 'email' => '*****@*****.**', 'pwd' => $hashed_pass, 'pwd_salt' => OwnerMySQLDAO::$default_salt, 'is_activated' => 1, 'is_admin' => 1));
     $builders[] = FixtureBuilder::build('instances', array('id' => 1));
     $builders[] = FixtureBuilder::build('owner_instances', array('owner_id' => 1, 'instance_id' => 1));
     $test_salt = 'test_salt';
     $password = ThinkUpTestLoginHelper::hashPasswordUsingCurrentMethod('secretpassword', $test_salt);
     $builders[] = FixtureBuilder::build('owners', array('id' => 6, 'email' => '*****@*****.**', 'pwd' => $password, 'pwd_salt' => $test_salt, 'is_activated' => 1, 'is_admin' => 1));
     return $builders;
 }
コード例 #4
0
 protected function buildData()
 {
     $builders = array();
     $hashed_pass = ThinkUpTestLoginHelper::hashPasswordUsingDeprecatedMethod("secretpassword");
     $builders[] = FixtureBuilder::build('owners', array('id' => 1, 'email' => '*****@*****.**', 'pwd' => $hashed_pass, 'pwd_salt' => OwnerMySQLDAO::$default_salt, 'is_activated' => 1, 'is_admin' => 1, 'api_key_private' => 'aabbccdd'));
     $test_salt = 'test_salt';
     $password = ThinkUpTestLoginHelper::hashPasswordUsingCurrentMethod('secretpassword', $test_salt);
     $builders[] = FixtureBuilder::build('owners', array('id' => 2, 'email' => '*****@*****.**', 'pwd' => $password, 'pwd_salt' => $test_salt, 'is_activated' => 1, 'is_admin' => 1, 'api_key_private' => ''));
     $builders[] = FixtureBuilder::build('owners', array('id' => 3, 'email' => '*****@*****.**', 'pwd' => $password, 'pwd_salt' => $test_salt, 'is_activated' => 0, 'is_admin' => 0));
     $builders[] = FixtureBuilder::build('owners', array('id' => 4, 'email' => '*****@*****.**', 'pwd' => $hashed_pass, 'pwd_salt' => OwnerMySQLDAO::$default_salt, 'is_activated' => 1, 'is_admin' => 0, 'api_key_private' => 'yayaya'));
     return $builders;
 }
コード例 #5
0
 protected function buildData()
 {
     $builders = array();
     $saltedpass = ThinkUpTestLoginHelper::hashPasswordUsingCurrentMethod('oldpassword', 'testsalt');
     $hashed_pass = ThinkUpTestLoginHelper::hashPasswordUsingDeprecatedMethod("oldpassword");
     $builders[] = FixtureBuilder::build('owners', array('id' => 1, 'full_name' => 'ThinkUp J. User', 'email' => '*****@*****.**', 'pwd' => $hashed_pass, 'pwd_salt' => OwnerMySQLDAO::$default_salt, 'activation_code' => '8888', 'is_activated' => 1));
     $builders[] = FixtureBuilder::build('owners', array('id' => 2, 'full_name' => 'Salted User', 'email' => '*****@*****.**', 'pwd' => $saltedpass, 'pwd_salt' => OwnerMySQLDAO::$default_salt, 'activation_code' => '8888', 'is_activated' => 1));
     $dao = DAOFactory::getDAO('OwnerDAO');
     $this->owner = $dao->getByEmail('*****@*****.**');
     $this->token = $this->owner->setPasswordRecoveryToken();
     $this->owner_salt = $dao->getByEmail('*****@*****.**');
     $this->token_salt = $this->owner_salt->setPasswordRecoveryToken();
     return $builders;
 }
コード例 #6
0
 /**
  * Set up necessary owner, instance, user, and owner_instance data to see fully-rendered insight markup
  * on debug.
  * @param Instance $instance Must have id, network, and network_username set
  * @return arr FixtureBuilders
  */
 protected function setUpPublicInsight(Instance $instance)
 {
     if (!isset($instance->network_user_id)) {
         $instance->network_user_id = '1001';
     }
     $builders = array();
     //Owner
     $pwd = ThinkUpTestLoginHelper::hashPasswordUsingCurrentMethod('pwd3', 'salt');
     $builders[] = FixtureBuilder::build('owners', array('id' => 1, 'full_name' => 'ThinkUp J. User', 'email' => '*****@*****.**', 'is_activated' => 1, 'pwd' => $pwd, 'pwd_salt' => 'salt'));
     //Public instance
     $builders[] = FixtureBuilder::build('instances', array('id' => $instance->id, 'network_user_id' => $instance->network_user_id, 'network_username' => $instance->network_username, 'network' => $instance->network, 'network_viewer_id' => '10', 'crawler_last_run' => '1988-01-20 12:00:00', 'is_active' => 1, 'is_public' => 1, 'posts_per_day' => 11, 'posts_per_week' => 77));
     //Owner instance
     $builders[] = FixtureBuilder::build('owner_instances', array('instance_id' => $instance->id, 'owner_id' => 1));
     //User
     $builders[] = FixtureBuilder::build('users', array('user_id' => $instance->network_user_id, 'network' => $instance->network));
     return $builders;
 }
コード例 #7
0
 public function testOfLoggedInServiceUsersNoInsights()
 {
     //set up owner
     $pwd1 = ThinkUpTestLoginHelper::hashPasswordUsingCurrentMethod('pwd3', 'salt');
     $builders[] = FixtureBuilder::build('owners', array('id' => 1, 'full_name' => 'ThinkUp J. User', 'email' => '*****@*****.**', 'is_activated' => 1, 'pwd' => $pwd1, 'pwd_salt' => OwnerMySQLDAO::$default_salt));
     //set up instance
     $builders[] = FixtureBuilder::build('instances', array('id' => 1, 'network_user_id' => '10', 'network_username' => 'jack', 'network' => 'twitter', 'network_viewer_id' => '10', 'crawler_last_run' => '1988-01-20 12:00:00', 'is_active' => 1, 'is_public' => 1, 'posts_per_day' => 11, 'posts_per_week' => 77));
     //set up owner instances
     $builders[] = FixtureBuilder::build('owner_instances', array('instance_id' => 1, 'owner_id' => 1));
     $this->simulateLogin('*****@*****.**', false);
     $controller = new InsightStreamController();
     $results = $controller->go();
     $this->assertNoPattern('/Email/', $results);
     $this->assertNoPattern('/Password/', $results);
     //don't show insights
     $this->assertNoPattern('/Hey these are some local followers!/', $results);
     $this->assertNoPattern('/Retweet spike! Jill\'s post privately got retweeted 110 times/', $results);
     $this->assertNoPattern('/Set up a/', $results);
     $this->assertPattern('/Check back later/', $results);
     $this->assertPattern('/update your ThinkUp data now/', $results);
     $this->debug($results);
 }
コード例 #8
0
 private function buildPublicStreamInsights()
 {
     $builders = array();
     //owner
     $salt = 'salt';
     $pwd1 = ThinkUpTestLoginHelper::hashPasswordUsingCurrentMethod('pwd3', $salt);
     $builders[] = FixtureBuilder::build('owners', array('id' => 1, 'full_name' => 'ThinkUp J. User', 'email' => '*****@*****.**', 'is_activated' => 1, 'pwd' => $pwd1, 'pwd_salt' => OwnerMySQLDAO::$default_salt));
     //public instance
     $builders[] = FixtureBuilder::build('instances', array('id' => 1, 'network_user_id' => '10', 'network_username' => 'jack', 'network' => 'twitter', 'network_viewer_id' => '10', 'crawler_last_run' => '1988-01-20 12:00:00', 'is_active' => 1, 'is_public' => 1, 'posts_per_day' => 11, 'posts_per_week' => 77));
     //owner instances
     $builders[] = FixtureBuilder::build('owner_instances', array('instance_id' => 1, 'owner_id' => 1));
     //public insights
     $time_now = date("Y-m-d H:i:s");
     $builders[] = FixtureBuilder::build('insights', array('date' => '2012-05-01', 'slug' => 'avg_replies_per_week', 'instance_id' => '1', 'headline' => 'Booyah!', 'text' => 'Hey these are some local followers!', 'emphasis' => Insight::EMPHASIS_HIGH, 'filename' => 'localfollowers', 'time_generated' => $time_now, 'related_data' => self::getRelatedDataListOfUsers(), 'header_image' => 'http://example.com/header_image.gif'));
     $builders[] = FixtureBuilder::build('insights', array('date' => '2012-06-01', 'slug' => 'avg_replies_per_week', 'instance_id' => '1', 'headline' => 'Booyah!', 'text' => 'This is a list of posts!', 'emphasis' => Insight::EMPHASIS_HIGH, 'filename' => 'favoriteflashbacks', 'time_generated' => $time_now, 'related_data' => self::getRelatedDataListOfPosts()));
     return $builders;
 }