Example #1
0
 def test_login(self):
     try:
         app.login()
     except:
         print("An error occured.")
     else:
         print("Ready to go")
Example #2
0
def test_login_bad_user_unittest(suite):
    params = {
        'username': '******',
        'password': '******'
    }
    suite['auth_req'].params = params
    with pytest.raises(ValueError):    # login() raises ValueError
        app.login(suite['auth_req'])
Example #3
0
def test_login_missing_params_unittest(suite):
    params = [
        {'username': '******'},
        {'password': '******'}
    ]
    for param in params:
        suite['auth_req'].params = param
        with pytest.raises(ValueError):
            app.login(suite['auth_req'])
Example #4
0
def test_login_bad_pass_unittest(suite):
    params = {
        'username': '******',
        'password': '******'
    }
    suite['auth_req'].params = params
    assert not app.login(suite['auth_req'])
Example #5
0
def test_app():

    username = '******'
    password = 1234567

    loginB = app.login()

    assert loginB == 1
Example #6
0
def test_login_success_unittest(suite):
    params = {
        'username': '******',
        'password': '******'
    }
    suite['auth_req'].params = params

    assert app.login(suite['auth_req'])
Example #7
0
 def test_login_with_code_success(self):
     for test in self.success_login_with_code:
         with patch("google_auth_oauthlib.flow") as flow,\
         patch("app.requests") as requests,\
         patch("googleapiclient.discovery.Resource") as build,\
         patch("app.update_tokens_in_db") as update_tokens,\
         patch("app.get_all_emails") as get_all_emails,\
         patch("app.add_new_person_to_db") as add_person,\
         patch("flask_socketio.SocketIO.emit") as emit:
             get_all_emails.side_effect = self.get_emails
             requests.get.return_value.value = test[PROFILE]
             requests.get.return_value.json.return_value = (
                 requests.get.return_value.value)
             app.login(test[INPUT])
             if (test[PROFILE][EMAIL] in self.get_emails()):
                 update_tokens.assert_called_once()
             else:
                 add_person.assert_called_once()
Example #8
0
def run():
    print(
        "\t\t\t\t\t\t\t\t\t\t\t\nTodoApp\n" +
        "\nWelcome to TodoApp.\n\nBasicly this app signup new users, then allow user to login with valid details.\nHence you can either 'Add New' task to your list or 'View' your task lists"
    )
    print("\nLet get going........\n")
    print("Login? Enter 'Login'\nSigup? Enter 'Signup'\n")

    userOption = input("Action here.....  ")
    userOption = userOption.capitalize()
    if userOption == "Login":
        login()

    elif userOption == "Signup":
        if signup():
            print("\nLogin to continue...")
            login()
    else:
        wrongOption()
Example #9
0
    def __init__(self, *args, **kwargs):
        Page.__init__(self, *args, **kwargs)

        #username label and text entry box
        usernameLabel = tk.Label(self, text="Username").grid(row=0, column=0)
        username = tk.StringVar()
        usernameEntry = tk.Entry(self, textvariable=username).grid(row=0, column=1)  

        #password label and password entry box
        passwordLabel = tk.Label(self,text="Password").grid(row=1, column=0)  
        password = tk.StringVar()
        passwordEntry = tk.Entry(self, textvariable=password, show='*').grid(row=1, column=1)

        loginUserButton = tk.Button(self, text ="Login", command = lambda: app.login(username.get(), password.get())).grid(row=4, column=1) 
        createUserButton = tk.Button(self, text ="Create User", command = lambda: app.create(username.get(), password.get())).grid(row=5, column=1) 
def createuser():
    if not 'username' in request.form or len(request.form['username']) == 0:
        return jsonify(message='No username in form sent'), 400
    if not 'password' in request.form or len(request.form['password']) == 0:
        return jsonify(message='No password in form sent'), 400
    # check if username already exists
    user = User.query.filter_by(username=request.form['username']).first()
    if not user is None:
        return jsonify(message='Username is taken'), 400

    # otherwise create it
    db.session.add(
        User(username=request.form['username'],
             password=request.form['password']))
    db.session.commit()
    #log them in
    return login()
Example #11
0
from app.login import *
login()
Example #12
0
import key_management, encrypt, setup
import sys, app

if (setup.setup_file != "1"):
    setup.setup()
    app.login()
else:
    app.login()
#What if you select two different drives by the USB location isn't a USB?
#What if someone changes the encrypted text in a file?
#Prompt user for password
#Select files to encrypt, what happens if not valid path?
#initialize_filepaths() is never called