def test_admin_api_admin_get(session,admin1_logged): '''Admin API get call by Admin''' #call get without ID, returns datatble check_api_get_datatable(url_for('admin.admin_api'),2) #call get on self id check_api_get(url_for('admin.admin_api',id=1)) #call get on id of another admin on same account check_api_get(url_for('admin.admin_api',id=2)) #call get with ID of admin in another account check_api_get_error(url_for('admin.admin_api',id=10),'Not Authorized')
def test_admin_api_admin_get(session, admin1_logged): '''Admin API get call by Admin''' #call get without ID, returns datatble check_api_get_datatable(url_for('admin.admin_api'), 2) #call get on self id check_api_get(url_for('admin.admin_api', id=1)) #call get on id of another admin on same account check_api_get(url_for('admin.admin_api', id=2)) #call get with ID of admin in another account check_api_get_error(url_for('admin.admin_api', id=10), 'Not Authorized')
def test_client_api_client_get(session,client1_logged): '''User API get call by Client''' client1 = Client.query.filter_by(email='*****@*****.**').first() #call get without ID, not authorized check_api_get_error(url_for('admin.user_api'),'Not Authorized') #call get on self user id check_api_get(url_for('admin.user_api',id=client1.id)) #call get with ID of client in another account check_api_get_error(url_for('admin.user_api',id=5),'Not Authorized')
def test_client_api_client_get(session, client1_logged): '''User API get call by Client''' client1 = Client.query.filter_by(email='*****@*****.**').first() #call get without ID, not authorized check_api_get_error(url_for('admin.user_api'), 'Not Authorized') #call get on self user id check_api_get(url_for('admin.user_api', id=client1.id)) #call get with ID of client in another account check_api_get_error(url_for('admin.user_api', id=5), 'Not Authorized')
def test_client_api_admin_get(session,admin1_logged): '''Client API get call by Admin''' client1 = Client.query.filter_by(email='*****@*****.**').first() client2 = Client.query.filter_by(email='*****@*****.**').first() #call get without ID, returns datatble check_api_get_datatable(url_for('admin.client_api'),2) #call get on id of client on same account check_api_get(url_for('admin.client_api',id=client1.id)) #call get with ID of client in another account check_api_get_error(url_for('admin.client_api',id=client2.id),'Not Authorized')
def test_device_api_client_get(session,client1_logged): '''Device API get call by Client''' site1 = Wifisite.query.filter_by(unifi_id='site1').first() site3 = Wifisite.query.filter_by(unifi_id='site3').first() #call get without ID, get all sites in account data = check_api_get(url_for('admin.device_api')) assert 3 == len(data),'Length of json data returned by AP API is not right' #call get on self user id check_api_get(url_for('admin.device_api',id=site1.id)) #call get with ID of client in another account check_api_get_error(url_for('admin.device_api',id=site3.id),'Not Authorized')
def test_client_api_admin_get(session, admin1_logged): '''Client API get call by Admin''' client1 = Client.query.filter_by(email='*****@*****.**').first() client2 = Client.query.filter_by(email='*****@*****.**').first() #call get without ID, returns datatble check_api_get_datatable(url_for('admin.client_api'), 2) #call get on id of client on same account check_api_get(url_for('admin.client_api', id=client1.id)) #call get with ID of client in another account check_api_get_error(url_for('admin.client_api', id=client2.id), 'Not Authorized')
def test_ap_api_client_get(session, client1_logged): '''Accesspoint API get call by Client''' site1 = Wifisite.query.filter_by(unifi_id='site1').first() site3 = Wifisite.query.filter_by(unifi_id='site3').first() #call get without ID, get all sites in account data = check_api_get(url_for('admin.ap_api')) assert 4 == len( data), 'Length of json data returned by AP API is not right' #call get on self user id check_api_get(url_for('admin.ap_api', id=site1.id)) #call get with ID of client in another account check_api_get_error(url_for('admin.ap_api', id=site3.id), 'Not Authorized')