Beispiel #1
0
 def __init__(self):
     self.first_name = ""
     self.last_name = ""
     self.user_name = ""
     self.email = ""
     self.password = ""
     self.created_at = None
     self.admin = False
     self.querry = UserQueries()
     self.user = {}
     self.users_list = []
    def setUp(self):
        My_app.config.from_object(app_config["testing"])
        self.app = My_app.test_client()
        self.db_obj = DbConn()
        self.con = self.db_obj.create_connection()
        self.db_obj.create_users_table()
        self.db_obj.create_menu_table()
        self.db_obj.create_orders_table()
        self.querry = UserQueries()
        self.hostname = "http://*****:*****@gmail.com",
            "password": "******"
        }

        self.resgistered_user = {"user_name": "mos", "password": "******"}
Beispiel #3
0
from functools import wraps
import jwt
from app.models.orders import Orders
from app.models.users import User
from app.models.db_user_sql_queries import UserQueries
from flasgger import swag_from
from flask import Blueprint, jsonify, request, current_app
from flask import redirect

user_blue = Blueprint('user_b', __name__)
user_obj = User()
order_obj = Orders()
querry = UserQueries()


@user_blue.route('/api/v1/auth/signup', methods=['POST'])
@swag_from('../docs/signup.yml')
def user_signup():
    " a function to signp user"
    new_user = request.json

    #validating user object
    if not user_obj.validate_user_obj(new_user):
        return jsonify({"error": "ivalid user obj"}), 400

    new_first_name = new_user["first_name"]
    new_last_name = new_user["last_name"]
    new_user_name = new_user["user_name"]
    new_email = new_user["email"]
    new_password = new_user["password"]