def test_get_all_includes_ccpo_user_changes(): user = UserFactory.create() initial_audit_log = AuditLog.get_all_events() Users.give_ccpo_perms(user) Users.revoke_ccpo_perms(user) assert len(AuditLog.get_all_events()) == len(initial_audit_log) + 2
def grant_ccpo_perms(dod_id): try: user = Users.get_by_dod_id(dod_id) if user.permission_sets: print("%s (DoD ID: %s) already CCPO user." % (user.full_name, user.dod_id)) else: Users.give_ccpo_perms(user) print("CCPO permissions successfully granted to %s (DoD ID: %s)." % (user.full_name, user.dod_id)) except NotFoundError: print("User not found.")
def confirm_new_user(): user = Users.get_by_dod_id(request.form["dod_id"]) Users.give_ccpo_perms(user) flash("ccpo_user_added", user_name=user.full_name) return redirect(url_for("ccpo.users"))
def test_give_ccpo_perms(): rando = UserFactory.create() Users.give_ccpo_perms(rando) ccpo_users = Users.get_ccpo_users() assert rando in ccpo_users