def test_login_success(request_factory):
     params = {EMAIL: TEST_USER_EMAIL, PASSWORD: TEST_PSSWD}
     request = request_factory.post(URL, params)
     request.session = Session()
     print '\tTesting Successful Login Using Verified Test User Account'
     response = view(request)
     print_expected_received({
         ERROR: False,
         MSG: LOGIN_SUCCESS
     }, response.content)
     response_object = json.loads(response.content)
     return response_object[ERROR] == False and response_object[
         MSG] == LOGIN_SUCCESS
 def test_login_account_not_verified(request_factory):
     params = {EMAIL: TEST_ADMIN_EMAIL, PASSWORD: TEST_PSSWD}
     request = request_factory.post(URL, params)
     request.session = Session()
     print '\tTesting Unverified Account Login Using Valid Test Admin Credentials'
     response = view(request)
     print_expected_received({
         ERROR: True,
         MSG: ACCOUNT_NOT_VERIFIED
     }, response.content)
     response_object = json.loads(response.content)
     return response_object[ERROR] == True and response_object[
         MSG] == ACCOUNT_NOT_VERIFIED
 def test_login_bad_passwd(request_factory):
     incorrect_pass = '******'
     params = {EMAIL: TEST_USER_EMAIL, PASSWORD: incorrect_pass}
     request = request_factory.post(URL, params)
     request.session = Session()
     print '\tTesting Login For Test User Using Incorrect Password: ' + incorrect_pass
     response = view(request)
     print_expected_received({
         ERROR: True,
         MSG: COMBINATION_INVALID
     }, response.content)
     response_object = json.loads(response.content)
     return response_object[ERROR] == True and response_object[
         MSG] == COMBINATION_INVALID
Ejemplo n.º 4
0
    def test_registration_blank_lname(request_factory):
        params = params = {
            EMAIL: TEST_USER_EMAIL,
            PASSWORD: TEST_PSSWD,
            CONFIRM_PASSWORD: TEST_PSSWD,
            FIRST_NAME: "Max",
            LAST_NAME: ""
        }
        print "\tTesting Registration Using Blank Last Name"
        request = request_factory.post(URL, params)
        response = view(request)
        print_expected_received({
            ERROR: True,
            MSG: LNAME_ERROR
        }, response.content)
        response_object = json.loads(response.content)

        return response_object[ERROR] == True and response_object[
            MSG] == LNAME_ERROR
Ejemplo n.º 5
0
    def test_registration_blank_email(request_factory):
        params = params = {
            EMAIL: "",
            PASSWORD: TEST_PSSWD,
            CONFIRM_PASSWORD: TEST_PSSWD,
            FIRST_NAME: "Max",
            LAST_NAME: "Pegasus"
        }
        print "\tTesting Registration With Blank Email"
        request = request_factory.post(URL, params)
        response = view(request)
        print_expected_received({
            ERROR: True,
            MSG: EMAIL_INVALID_ERROR
        }, response.content)
        response_object = json.loads(response.content)

        return response_object[ERROR] == True and response_object[
            MSG] == EMAIL_INVALID_ERROR
Ejemplo n.º 6
0
    def test_registration_chatbot_user_success(request_factory):
        params = params = {
            EMAIL: TEST_USER_EMAIL,
            PASSWORD: "******",
            CONFIRM_PASSWORD: "******",
            FIRST_NAME: "Max",
            LAST_NAME: "Pegasus"
        }
        print "\tTesting Successful ChatBot User Registration Using Email: " + TEST_USER_EMAIL + \
              "\n\tCreates Account and Sends Verification Email (Email Transporting May Take a Few Moments...)"
        request = request_factory.post(URL, params)
        response = view(request)
        print_expected_received({
            ERROR: False,
            MSG: CREATED_USER
        }, response.content)
        response_object = json.loads(response.content)

        return response_object[ERROR] == False and response_object[
            MSG] == CREATED_USER
Ejemplo n.º 7
0
    def test_registration_bad_psswd_length(request_factory):
        params = params = {
            EMAIL: TEST_USER_EMAIL,
            PASSWORD: "******",
            CONFIRM_PASSWORD: "******",
            FIRST_NAME: "Max",
            LAST_NAME: "Pegasus"
        }
        print "\tTesting Registration Using Password That Is Too Short: " + params[
            PASSWORD]
        request = request_factory.post(URL, params)
        response = view(request)
        print_expected_received({
            ERROR: True,
            MSG: PASS_LENGTH_ERROR
        }, response.content)
        response_object = json.loads(response.content)

        return response_object[ERROR] == True and response_object[
            MSG] == PASS_LENGTH_ERROR
Ejemplo n.º 8
0
    def test_registration_bad_psswd_match(request_factory):
        params = params = {
            EMAIL: TEST_USER_EMAIL,
            PASSWORD: "******",
            CONFIRM_PASSWORD: "******",
            FIRST_NAME: "Max",
            LAST_NAME: "Pegasus"
        }
        print "\tTesting Registration Using Passwords That Do Not Match: " + params[
            PASSWORD] + " " + params[CONFIRM_PASSWORD]
        request = request_factory.post(URL, params)
        response = view(request)
        print_expected_received({
            ERROR: True,
            MSG: PASS_MATCH_ERROR
        }, response.content)
        response_object = json.loads(response.content)

        return response_object[ERROR] == True and response_object[
            MSG] == PASS_MATCH_ERROR
Ejemplo n.º 9
0
    def test_registration_bad_psswd_symbols(request_factory):
        params = params = {
            EMAIL: TEST_USER_EMAIL,
            PASSWORD: "******",
            CONFIRM_PASSWORD: "******",
            FIRST_NAME: "Max",
            LAST_NAME: "Pegasus"
        }
        print "\tTesting Registration Using Password That Fails Symbol Requirements: " + params[
            PASSWORD]
        request = request_factory.post(URL, params)
        response = view(request)
        print_expected_received({
            ERROR: True,
            MSG: PASS_SYMBOL_ERROR
        }, response.content)
        response_object = json.loads(response.content)

        return response_object[ERROR] == True and response_object[
            MSG] == PASS_SYMBOL_ERROR
Ejemplo n.º 10
0
    def test_registration_admin_user_success(request_factory):
        params = params = {
            EMAIL: TEST_ADMIN_EMAIL,
            PASSWORD: "******",
            CONFIRM_PASSWORD: "******",
            FIRST_NAME: "Max",
            LAST_NAME: "Pegasus",
            ACCOUNT_TYPE: ADMIN
        }
        print "\tTesting Successful Admin User Registration Using Random Email: " + TEST_ADMIN_EMAIL + \
              "\n\tCreates Account and Sends Verification Email to OIT for Admin Account Confirmation. " \
              "\n\tDevelopment OIT email: " + OIT_EMAIL + \
              "\n\t(Email Transporting May Take a Few Moments...)"
        request = request_factory.post(URL, params)
        response = view(request)
        print_expected_received({
            ERROR: False,
            MSG: CREATED_ADMIN
        }, response.content)
        response_object = json.loads(response.content)

        return response_object[ERROR] == False and response_object[
            MSG] == CREATED_ADMIN