예제 #1
0
 def setUp(self):
     self.username = '******'
     self.hashed_password = '******'
     self.salt = os.urandom(32)
     self.content_credentials = 'app_id:secret_key'
     self.user = model.User(self.username, self.hashed_password, self.salt,
                            self.content_credentials)
예제 #2
0
 def register_user(self, username, plaintext_password):
     salt = os.urandom(64)
     password_hash = auth.hash_password(plaintext_password, salt)
     user = model.User(username, password_hash, salt)
     self._user_manager.add_user(user, self._content_manager)
     self._do_login(user)
     return user
예제 #3
0
 def test_content_credentials_default_to_none_if_not_provided(self):
     """
     The idea behind this behavior is that not all content managers will
     necessarily have authentication, so we want to make it optional
     """
     user = model.User(self.username, self.hashed_password, self.salt)
     self.assertIsNone(user.content_credentials)
예제 #4
0
 def test_returns_cached_user_if_already_added(self):
     username = '******'
     bob = model.User(username, 'bob_password', b'salt')
     self.user_manager.add_user(bob, self.content_manager)
     user = self.user_manager.get_user(username)
     self.assertIs(user, bob)
     self.assertIsNone(self.user_data_store.invoked_username)
예제 #5
0
 def setUp(self):
     super(TestAddUser, self).setUp()
     self.user = model.User('bob', 'bob_password', b'salt')
     self.user_manager.add_user(self.user, self.content_manager)
예제 #6
0
 def get_user(self, username):
     self.invoked_username = username
     if username != '<invalid user>' and self.deleted_user is None:
         return model.User(username, 'a password', b'salt')
 def setUp(self):
     self.dynamodb = DynamoDbDouble()
     config = {'USER_DB_TABLE': 'the_user_table'}
     self.data_store = datastore.UserDataStore(config, self.dynamodb)
     self.user = model.User('realuser', 'a_password', b'salt')
     self.data_store.add_user(self.user)