def test_create_key(api): username = '******' password = '******' key = UserData.from_userpass_pair(username, password, api.get_cluster_uuid()).key key = key[20:40].encode('hex') assert core.create_key(username, password) == key
def create_user(cluster, email, password=None, quota=None): """Creates user in given vcluster.""" key = core.create_key(email, password) if password \ else core.generate_user_key() desc = {} if cluster.is_root else core.add_vcluster_to_desc(cluster, {}) sx.createUser(email, userType='normal', userKey=key, desc=desc, quota=quota)
def create_user(email, password=None): """Creates a user.""" if password: key = core.create_key(email, password) else: key = core.generate_user_key() api.createUser(email, userType='normal', userKey=key)
def consume(self, password): """Set the password and delete all tokens.""" sx.modifyUser(self.email, create_key(self.email, password)) UserPasswordReset.objects.filter(email=self.email).delete()
def consume(self, password): """Set the password and delete all tokens.""" api.modifyUser(self.email, create_key(self.email, password)) UserPasswordReset.objects.filter(email=self.email).delete()