Beispiel #1
0
def test_user_api_client_post(session, client1_logged):
    '''USer API post call by Client'''
    client1 = Client.query.filter_by(email='*****@*****.**').first()

    #post without ID is not allowed
    check_api_post_error(
        url_for('admin.user_api'), {
            'email': '*****@*****.**',
            'displayname': 'sdghadg',
            'password': '******',
            'repassword': '******'
        }, 'Not Authorized')
    #post with another  ID is not allowed
    check_api_post_error(
        url_for('admin.user_api', id=5), {
            'email': '*****@*****.**',
            'displayname': 'sdghadg',
            'password': '******',
            'repassword': '******'
        }, 'Not Authorized')

    check_api_post(
        url_for('admin.user_api', id=client1.id), {
            'email': '*****@*****.**',
            'displayname': 'sdgasdasdhadg',
            'password': '******',
            'repassword': '******'
        })
Beispiel #2
0
def test_admin_api_admin_post_error(session,admin1_logged):
    '''Admin API post call by Admin'''
    #post empty form
    check_api_post_mandatory_fields_check(url_for('admin.admin_api'),
                ['email','displayname'],UserForm)

    #post with passwords not matching
    assert "Error in the Password field - Entered passwords didn't match </br>" == check_api_post_error(url_for('admin.admin_api'),
                {'email':'*****@*****.**','displayname':'sdghadg','password':'******'})

    #post with email already exists
    assert "Value already exists in the database" == check_api_post_error(url_for('admin.admin_api'),
                {'email':'*****@*****.**','displayname':'sdghadg','password':'******','repassword':'******'})
Beispiel #3
0
def test_user_api_client_post(session,client1_logged):
    '''USer API post call by Client''' 
    client1 = Client.query.filter_by(email='*****@*****.**').first()
    
    #post without ID is not allowed
    check_api_post_error(url_for('admin.user_api'),
                {'email':'*****@*****.**','displayname':'sdghadg','password':'******','repassword':'******'},'Not Authorized')
    #post with another  ID is not allowed
    check_api_post_error(url_for('admin.user_api',id=5),
                {'email':'*****@*****.**','displayname':'sdghadg','password':'******','repassword':'******'},'Not Authorized')

    check_api_post(url_for('admin.user_api',id=client1.id),
                {'email':'*****@*****.**','displayname':'sdgasdasdhadg','password':'******','repassword':'******'})
Beispiel #4
0
def test_client_api_admin_post_error(session, admin1_logged):
    '''Client API post call by Admin'''
    #post empty form
    check_api_post_mandatory_fields_check(url_for('admin.client_api'),
                                          ['email', 'displayname'], UserForm)

    #post with passwords not matching
    assert "Error in the Password field - Entered passwords didn't match </br>" == check_api_post_error(
        url_for('admin.client_api'), {
            'email': '*****@*****.**',
            'displayname': 'sdghadg',
            'password': '******'
        })

    #post with email already exists
    assert "Value already exists in the database" == check_api_post_error(
        url_for('admin.client_api'), {
            'email': '*****@*****.**',
            'displayname': 'sdghadg',
            'password': '******',
            'repassword': '******'
        })
Beispiel #5
0
def test_device_api_client_post(session,client1_logged):
    '''Device API post call by Client'''
    site1 = Wifisite.query.filter_by(unifi_id='site1').first()    
    check_api_post_error(url_for('admin.device_api',id=site1.id),'Not Allowed')
Beispiel #6
0
def test_ap_api_admin_post(session,admin1_logged):
    '''Accesspoint API post call by Admin'''
    site1 = Wifisite.query.filter_by(unifi_id='site1').first()    
    check_api_post_error(url_for('admin.ap_api',id=site1.id),'Not Allowed')
Beispiel #7
0
def test_device_api_client_post(session, client1_logged):
    '''Device API post call by Client'''
    site1 = Wifisite.query.filter_by(unifi_id='site1').first()
    check_api_post_error(url_for('admin.device_api', id=site1.id),
                         'Not Allowed')
Beispiel #8
0
def test_ap_api_admin_post(session, admin1_logged):
    '''Accesspoint API post call by Admin'''
    site1 = Wifisite.query.filter_by(unifi_id='site1').first()
    check_api_post_error(url_for('admin.ap_api', id=site1.id), 'Not Allowed')