def delete(self, id): _user = User.delete(id, db) if _user != "": result = True else: result = False return result, date_time_today(), 'delete()'
def get(self, id): _user = User.get(id) if _user != "": result = True else: result = False return result, date_time_today(), 'get()'
def get_all(self): _users = User.get_all() if _users != []: result = True else: result = False return result, date_time_today(), 'get_all()'
def authenticate(): user = User() _user = user.user_by_usercpf( request.form['usercpf']) # Caso encontre o usuário, retorna # Caso o usuáro seja encontrado if _user != None: resultPassaword = user.check_password(request.form['password'], _user.password_hash) # Caso o usuáro seja encontrado if resultPassaword: login_user(_user) return redirect(url_for('index')) else: return redirect(url_for('login')) else: return redirect(url_for('login'))
def insert_2(self): data = {'username': '******', 'usercpf': '222.222.222-22', 'email': '[email protected] ', 'password_hash': self.password_hash} _user = User.insert(data, db) if _user != "": result = True else: result = False return result, date_time_today(), 'insert_user_2()'
def insert(self): data = {'username': self.username, 'usercpf': self.usercpf, 'email': self.email, 'password_hash': self.password_hash} _user = User.insert(data, db) if _user != "": result = True else: result = False return result, date_time_today(), 'insert()'
def insert_db(file, fileExtension): dataFile = { 'name': os.path.splitext(file.filename)[0], 'path': file.filename, 'insertion_date': datetime.now(), 'size': get_size(file), 'extension': fileExtension, 'expiration_date': datetime.now(), '_bucket': Bucket.get_for_name(name=current_user.bucket[0].name), '_user': User.get(id=current_user.id) } _file = File().insert(data=dataFile, db=db) if _file: return True return False
def load_user(id): return User().user_by_id(id)
dicResult = {} #Cria um dicionário que irá conter todos os resultados dos testes listResult = [] #Teste com User _userTest = UserTest() listResult.append(_userTest.insert()) listResult.append(_userTest.insert_2()) listResult.append(_userTest.get_all()) listResult.append(_userTest.get(id=1)) dicResult['User'] = listResult listResult = [] #Teste com Bucket _bucketTeste = BucketTest() listResult.append(_bucketTeste.insert(_user=User.get(1))) listResult.append(_bucketTeste.insert(_user=User.get(2))) listResult.append(_bucketTeste.get_all()) listResult.append(_bucketTeste.get(id=1)) dicResult['Bucket'] = listResult listResult = [] #Teste com File _fileTest = FileTest() listResult.append(_fileTest.insert('txt', _user=User.get(1), _bucket=Bucket.get_for_name(User.get(1).usercpf))) listResult.append(_fileTest.get_all()) listResult.append(_fileTest.get(id=1)) dicResult['File'] = listResult