def test_get_chats_route(): """ Testing chats page Method : GET """ set_token(client, "user0011") response = client.get(url) assert response.status_code == 200
def test_get_about_route_auth(): """ Testing about page with user session Method : GET """ set_token(client, "user0011") response = client.get(url) assert response.status_code == 202
def test_get_user_route_auth_not_admin(): """ Testing users page Method : GET """ set_token(client, "user0011") response = client.get(url) assert response.status_code == 200
def test_get_profile_route_auth_not_admin(): """ Testing profile page with user session as not admin Method : GET """ set_token(client, "user0011") response = client.get(url) assert response.status_code == 200
def test_get_login_route_with_session(): """ Testing login page with user session Method : GET """ set_token(client, "user9474") response = client.get(url) assert response.status_code == 302
def test_get_admin_route_auth_not_admin(): """ Testing chat page with not admin user session Method : GET """ url = '/admin/' set_token(client, "user0011") response = client.get(url) assert response.status_code == 302
def test_get_wrong_department_route(): """ Testing department page with wrong uuid Method : GET """ url = '/department/{}'.format("1111") set_token(client, "user0011") response = client.get(url) assert response.status_code == 302
def test_get_wrong_user_route(): """ Testing user page with wrong uuid Method : GET """ url = '/user/{}'.format("1111") set_token(client, "user9474") response = client.get(url) assert response.status_code == 302
def test_get_department_route(): """ Testing department page Method : GET """ user = db.session.query(Department).filter(Department.title == "Bank blockchain").first() url = '/department/{}'.format(user.uuid) set_token(client, "user0011") response = client.get(url) assert response.status_code == 200
def test_get_user_route_auth_not_admin(): """ Testing user page with user session as not admin Method : GET """ user = db.session.query(User).filter(User.username == "user7433").first() url = '/user/{}'.format(user.uuid) set_token(client, "user0011") response = client.get(url) assert response.status_code == 200
def test_delete_user_with_user_session_as_not_admin(): """ Testing delete user page with user session as not admin Method : DELETE """ user = db.session.query(User).filter(User.username == "user7433").first() url = '/user/{}'.format(user.uuid) set_token(client, "user0011") response = client.delete(url) assert response.status_code == 302
def test_post_logout(): """ Testing logout page with right data Method : POST """ set_token(client, "user9474") response = client.get('/login') url = '/logout' response = client.post(url, data={}) url = '/login' response = client.get(url) assert response.status_code == 200
def test_put_wrong_user_route(): """ Testing user page with wrong uuid Method : PUT """ url = '/user/{}'.format("1111") set_token(client, "user9474") resp_dict = { "username": "******", "name": "test", "surname": "test", "email_address": "test" } response = client.put(url, data=resp_dict) assert response.status_code == 302
def test_put_user_route_wrong_data_auth_admin(): """ Testing put page with wrong data Method : PUT """ user = db.session.query(User).filter(User.username == "user7433").first() url = '/user/{}'.format(user.uuid) set_token(client, "user9474") resp_dict = { "username": "******", "name": "test", "surname": "test", "email_address": "test" } response = client.put(url, data=resp_dict) assert response.status_code == 302
def test_put_user_with_user_session_as_not_admin(): """ Testing user page with user session as not admin Method : PUT """ user = db.session.query(User).filter(User.username == "user7433").first() resp_dict = { "username": "******", "name": "test", "surname": "test", "email_address": "test" } url = '/user/{}'.format(user.uuid) set_token(client, "user0011") response = client.put(url, data=resp_dict) assert response.status_code == 302