Exemplo n.º 1
0
def test_guest_portal1(session):
    '''Check if configuring different auth_methods gives out proper landing pages'''
    site1 = Wifisite.query.filter_by(id=1).first()
    mac = randomMAC()
    ap_mac = randomMAC()    
    site1.auth_method = AUTH_TYPE_SOCIAL + AUTH_TYPE_SMS + AUTH_TYPE_EMAIL +AUTH_TYPE_VOUCHER
    db.session.commit()
    url = get_guest_url(site1,mac,ap_mac,demo=0)
    check_multi_login_page(url)

    site1.auth_method = AUTH_TYPE_SOCIAL 
    db.session.commit()
    url = get_guest_url(site1,mac,ap_mac,demo=0)
    check_facebook_login_page(url)

    site1.auth_method = AUTH_TYPE_SMS 
    db.session.commit()
    url = get_guest_url(site1,mac,ap_mac,demo=0)
    check_phone_login_page(url)

    site1.auth_method = AUTH_TYPE_EMAIL 
    db.session.commit()
    url = get_guest_url(site1,mac,ap_mac,demo=0)
    check_email_login_page(url)

    site1.auth_method = AUTH_TYPE_VOUCHER 
    db.session.commit()
    url = get_guest_url(site1,mac,ap_mac,demo=0)
    check_voucher_login_page(url)
Exemplo n.º 2
0
def test_guest_portal1(session):
    """Check if configuring different auth_methods gives out proper landing pages"""
    site1 = Wifisite.query.filter_by(id=1).first()
    mac = randomMAC()
    ap_mac = randomMAC()
    site1.auth_method = AUTH_TYPE_SOCIAL + AUTH_TYPE_SMS + AUTH_TYPE_EMAIL + AUTH_TYPE_VOUCHER
    db.session.commit()
    url = get_guest_url(site1, mac, ap_mac, demo=0)
    check_multi_login_page(url)

    site1.auth_method = AUTH_TYPE_SOCIAL
    db.session.commit()
    url = get_guest_url(site1, mac, ap_mac, demo=0)
    check_facebook_login_page(url)

    site1.auth_method = AUTH_TYPE_SMS
    db.session.commit()
    url = get_guest_url(site1, mac, ap_mac, demo=0)
    check_phone_login_page(url)

    site1.auth_method = AUTH_TYPE_EMAIL
    db.session.commit()
    url = get_guest_url(site1, mac, ap_mac, demo=0)
    check_email_login_page(url)

    site1.auth_method = AUTH_TYPE_VOUCHER
    db.session.commit()
    url = get_guest_url(site1, mac, ap_mac, demo=0)
    check_voucher_login_page(url)
Exemplo n.º 3
0
def test_facebook_login1(session):
    '''Test facebook_login view with in valid parameters

     '''

    site1        = Wifisite.query.filter_by(unifi_id='site1').first() 
    site1.auth_method = AUTH_TYPE_SOCIAL      
    mac = randomMAC()
    ap_mac1 = randomMAC()
    url1 = get_guest_url(site1,mac,ap_mac1,1)      

    #invalid guestrack id
    check_404(url_for('guest.facebook_login',track_id=str(uuid.uuid4())))

    #test valid trackid but no session
    track_id = str(uuid.uuid4())
    guest_track = Guesttrack(ap_mac=ap_mac1,device_mac=mac,site=site1,state=GUESTRACK_INIT,orig_url='',track_id=track_id)
    db.session.add(guest_track)
    db.session.commit()
    check_404(url_for('guest.facebook_login',track_id=track_id))    


    #Create device 
    guest_device = Device(mac=mac,site=site1,state=DEVICE_INIT)
    site1.devices.append(guest_device)
    db.session.add(guest_device)
    db.session.commit() 
    check_facebook_login_page(url_for('guest.facebook_login',track_id=track_id))   
Exemplo n.º 4
0
def test_facebook_login1(session):
    """Test facebook_login view with in valid parameters

     """

    site1 = Wifisite.query.filter_by(unifi_id="site1").first()
    site1.auth_method = AUTH_TYPE_SOCIAL
    mac = randomMAC()
    ap_mac1 = randomMAC()
    url1 = get_guest_url(site1, mac, ap_mac1, 1)

    # invalid guestrack id
    check_404(url_for("guest.facebook_login", track_id=str(uuid.uuid4())))

    # test valid trackid but no session
    track_id = str(uuid.uuid4())
    guest_track = Guesttrack(
        ap_mac=ap_mac1, device_mac=mac, site=site1, state=GUESTRACK_INIT, orig_url="", track_id=track_id
    )
    db.session.add(guest_track)
    db.session.commit()
    check_404(url_for("guest.facebook_login", track_id=track_id))

    # Create device
    guest_device = Device(mac=mac, site=site1, state=DEVICE_INIT)
    site1.devices.append(guest_device)
    db.session.add(guest_device)
    db.session.commit()
    check_facebook_login_page(url_for("guest.facebook_login", track_id=track_id))