示例#1
0
def test_addjudge2():
    User.query.delete()
    new_judge = add_lawyer_judge({"usr_type":"Judge","username":"******","usr_addr":"Kol","name":"JUD1","password":"******"})
    inv_judge = add_lawyer_judge({"usr_type":"Judge","username":"******","usr_addr":"Kol","name":"JUD1","password":"******"})
    print("Trying to add judge with username : '******' that already exists ")
    print(inv_judge)
    expected_msg = {"add_status":"0","err_msg":"Username Already Exists"}
    assert json.loads(inv_judge)==expected_msg
示例#2
0
def test_addlawyer2():    
    User.query.delete()
    new_lawyer = add_lawyer_judge({"usr_type": "Lawyer", "username": "******", "usr_addr": "Kol", "name": "LAW1", "password": "******"})
    inv_lawyer = add_lawyer_judge({"usr_type": "Lawyer", "username": "******", "usr_addr": "Kol", "name": "LAW1", "password": "******"})
    expected_msg = {"add_status":"0","err_msg":"Username Already Exists"}
    print("Trying to add lawyer with username : '******' that already exists ")
    print(inv_lawyer)
    assert json.loads(inv_lawyer) == expected_msg
示例#3
0
def test_addlawyer2():    
    User.query.delete()
    new_lawyer = add_lawyer_judge(
        {"usr_type": "Lawyer", "username": "******", "usr_addr": "Kol", "name": "LAW1", "password": "******"})
    inv_lawyer = add_lawyer_judge(
        {"usr_type": "Lawyer", "username": "******", "usr_addr": "Kol", "name": "LAW1", "password": "******"})
    expected_msg = {"add_status": "0",
                    "err_msg": "Sorry!!We were unable to create the account!! The username probably exists !!"}
    assert json.loads(inv_lawyer) == expected_msg
示例#4
0
def test_addlawyer2():    
    User.query.delete()
   
    new_lawyer = add_lawyer_judge(
        {"usr_type": "Lawyer", "username": "******", "usr_addr": "Kol", "name": "LAW1", "password": "******"})
    
    inv_lawyer = add_lawyer_judge(
        {"usr_type": "Lawyer", "username": "******", "usr_addr": "Kol", "name": "LAW1", "password": "******"})
    expected_msg =  {"add_status":"0","err_msg":"Username Already Exists"}
    assert inv_lawyer == expected_msg
示例#5
0
def test_addjudge():
    User.query.delete()
    new_judge = add_lawyer_judge({"usr_type":"Judge","username":"******","usr_addr":"Kol","name":"JUD1","password":"******"})
    print("adding Judge details: {\"usr_type\": \"Judge\", \"username\": \"judge1\", \"usr_addr\": \"Kol\", \"name\": \"JUD1\", \"password\": \"12345\"}")
    print(new_judge)
    expected_msg = {"add_status":"1", "err_msg":"The account of has been created successfully!!"}
    assert json.loads(new_judge)==expected_msg
示例#6
0
def test_addjudge():
    print(User.query.all())
    User.query.delete()
    print(User.query.all())
    new_judge = add_lawyer_judge({"usr_type":"Judge","username":"******","usr_addr":"Kol","name":"JUD1","password":"******"})
    expected_msg = {"add_status":"1", "err_msg":"The account of has been created successfully!!"}
    assert json.loads(new_judge)==expected_msg
示例#7
0
def test_addlawyer():    
    User.query.delete()
    new_lawyer = add_lawyer_judge(
        {"usr_type": "Lawyer", "username": "******", "usr_addr": "Kol", "name": "LAW1", "password": "******"})
    expected_msg = {"add_status": "1",
                    "err_msg": "The account of has been created successfully!!"}
    assert json.loads(new_lawyer) == expected_msg
示例#8
0
def test_removejudge():    
    User.query.delete()
    new_Judge = add_lawyer_judge({"usr_type": "Judge", "username": "******", "usr_addr": "Kol", "name": "J", "password": "******"})
    rmv_judge = remove_lawyer_judge({"username": "******"})
    print("Trying to remove judge with username : '******' that exists ")
    print(rmv_judge) 
    expected_msg = {"removed_status": "1","err_msg": "Username removed successfully!!"}
    assert json.loads(rmv_judge) == expected_msg
示例#9
0
def test_removelawyer():   
    User.query.delete()
    new_lawyer = add_lawyer_judge({"usr_type": "Lawyer", "username": "******", "usr_addr": "Kol", "name": "LAW1", "password": "******"})
    rmv_lawyer = remove_lawyer_judge({"username": "******"})   
    print("Trying to remove lawyer with username : '******' that exists ")
    print(rmv_lawyer) 
    expected_msg = {"removed_status": "1","err_msg": "Username removed successfully!!"}
    assert json.loads(rmv_lawyer) == expected_msg
示例#10
0
def test_addlawyer():    
    User.query.delete()
    new_lawyer = add_lawyer_judge(
        {"usr_type": "Lawyer", "username": "******", "usr_addr": "Kol", "name": "LAW1", "password": "******"})
    expected_msg = {"add_status": "1", "err_msg": "The account of has been created successfully!!"}
    print("adding lawyer details: {\"usr_type\": \"Lawyer\", \"username\": \"lawyer1\", \"usr_addr\": \"Kol\", \"name\": \"LAW1\", \"password\": \"12345\"}")
    print(new_lawyer)
    assert json.loads(new_lawyer) == expected_msg
示例#11
0
def test_getuserlist():
    new_Judge = add_lawyer_judge({"usr_type": "Judge", "username": "******", "usr_addr": "Kol", "name": "J", "password": "******"})
    new_lawyer = add_lawyer_judge({"usr_type": "Lawyer", "username": "******", "usr_addr": "Kol", "name": "LAW1", "password": "******"})
    new_Judge = add_lawyer_judge({"usr_type": "Judge", "username": "******", "usr_addr": "Bombay", "name": "judUser2", "password": "******"})
    new_lawyer = add_lawyer_judge({"usr_type": "Lawyer", "username": "******", "usr_addr": "Kol", "name": "LAW1", "password": "******"})
    rmv_judge = remove_lawyer_judge({"username":"******"})
    new_lawyer = add_lawyer_judge({"usr_type": "Lawyer", "username": "******", "usr_addr": "Chennai", "name": "LAW2", "password": "******"})
    all_users = get_user_list()
    all_users = get_user_list()
    print("The users are:")
    print(all_users)
    expected_output = {
        "usr_list": [
            {"username": "******", "name": "J", "usr_type": "Judge"},
            {"username": "******", "name": "LAW1", "usr_type": "Lawyer"},
            {"username": "******", "name": "judUser2", "usr_type": "Judge"},
            {"username": "******", "name": "LAW2", "usr_type": "Lawyer"}
            ],
            "confirm":"1",
            "message": "Success!! Here is the list of users!!"
    }
    assert json.loads(all_users) == expected_output
示例#12
0
def create_basic_db():
    # CourtCase.query.delete()
    # User.query.delete()
    # SlotList.query.delete()
    #add users
    reg = add_lawyer_judge({"usr_type": "Registrar", "username": "******", "usr_addr": "Kolkata", "name": "R", "password": "******"})
    new_Judge = add_lawyer_judge({"usr_type": "Judge", "username": "******", "usr_addr": "Kol", "name": "J", "password": "******"})
    new_lawyer = add_lawyer_judge({"usr_type": "Lawyer", "username": "******", "usr_addr": "Kol", "name": "LAW1", "password": "******"})
    #add cases
    #CASE A
    new_case = enter_details_into_db(
        {
            "def_name": "A",
            "def_addr": "CDE",
            "crime_type": "theft",
            "crime_date": {"month": "2", "year": "2021", "day": "28"},
            "crime_loc": "Park Street ",
            "arresting_off_name": " Ram Pal",
            "arrest_date": {"month": "3", "year": "2021", "day": "1"},
            "name_pres_judge": "Rohan Ray",
            "public_prosecutor_name": "Raghu Sen ",
            "starting_date": {"month": "3", "year": "2021", "day": "2"},
            "expected_completion_date": {"month":"3", "year":"2021", "day":"7"},
            "hearing_slot":"1",
            "hearing_date":{"month": "3", "year": "2021", "day": "2"}
        }
    )
    # CASE B
    new_case = enter_details_into_db(
        {
            "def_name": "B",
            "def_addr": "CDE",
            "crime_type": "robbery",
            "crime_date": {"month": "3", "year": "2021", "day": "15"},
            "crime_loc": "Santragachi",
            "arresting_off_name": "Amresh Sen",
            "arrest_date": {"month": "3", "year": "2021", "day": "20"},
            "name_pres_judge": "Abhijit Ray",
            "public_prosecutor_name": "Raghu Sen ",
            "starting_date": {"month": "3", "year": "2021", "day": "21"},
            "expected_completion_date": {"month":"3", "year":"2021", "day":"30"},
            "hearing_slot":"1",
            "hearing_date":{"month": "3", "year": "2021", "day": "21"}
        }
    )
    #CASE C
    new_case = enter_details_into_db(
        {
            "def_name": "C",
            "def_addr": "CVB",
            "crime_type": "arson",
            "crime_date": {"month": "3", "year": "2021", "day": "15"},
            "crime_loc": "Salt Lake",
            "arresting_off_name": " DCV",
            "arrest_date": {"month": "3", "year": "2021", "day": "20"},
            "name_pres_judge": "iop",
            "public_prosecutor_name": "SDC",
            "starting_date": {"month": "3", "year": "2021", "day": "21"},
            "expected_completion_date": {"month":"3", "year":"2021", "day":"30"},
            "hearing_slot":"3",
            "hearing_date":{"month": "3", "year": "2021", "day": "21"}
        }
    )
    #CASE D
    new_case = enter_details_into_db(
        {
            "def_name": "D",
            "def_addr": "DEF",
            "crime_type": "murder",
            "crime_date": {"month": "3", "year": "2021", "day": "15"},
            "crime_loc": "Park Street",
            "arresting_off_name": "ioptestkey",
            "arrest_date": {"month": "3", "year": "2021", "day": "20"},
            "name_pres_judge": "Raghu Sen",
            "public_prosecutor_name": "Ranjan Bose",
            "starting_date": {"month": "3", "year": "2021", "day": "19"},
            "expected_completion_date": {"month":"3", "year":"2021", "day":"30"},
            "hearing_slot":"5",
            "hearing_date":{"month": "3", "year": "2021", "day": "21"}
           }
    )

    #close case C & D
    close = close_case({'cin':3,'case_summary':"closed"})
    # print(close)
    close = close_case({'cin':4,'case_summary':"closed"})
示例#13
0
def create_basic_db():
    #add users
    reg = add_lawyer_judge({"usr_type": "Registrar", "username": "******", "usr_addr": "Kolkata", "name": "R", "password": "******"})
    new_Judge = add_lawyer_judge({"usr_type": "Judge", "username": "******", "usr_addr": "Kol", "name": "J", "password": "******"})
    new_lawyer = add_lawyer_judge({"usr_type": "Lawyer", "username": "******", "usr_addr": "Kol", "name": "LAW1", "password": "******"})
    #add cases
    #CASE A
    new_case = enter_details_into_db(
        {
            "def_name": "A",
            "def_addr": "CDE",
            "crime_type": "theft",
            "crime_date": {"month": "2", "year": "2021", "day": "28"},
            "crime_loc": "Park Street ",
            "arresting_off_name": " Ram Pal",
            "arrest_date": {"month": "3", "year": "2021", "day": "1"},
            "name_pres_judge": "Rohan Ray",
            "public_prosecutor_name": "Raghu Sen ",
            "starting_date": {"month": "3", "year": "2021", "day": "2"},
            "expected_completion_date": {"month":"3", "year":"2021", "day":"7"},
            "hearing_slot":"1",
            "hearing_date":{"month": "3", "year": "2021", "day": "2"}
        }
    )
    # CASE B
    new_case = enter_details_into_db(
        {
            "def_name": "B",
            "def_addr": "CDE",
            "crime_type": "robbery",
            "crime_date": {"month": "3", "year": "2021", "day": "15"},
            "crime_loc": "Santragachi",
            "arresting_off_name": "Amresh Sen",
            "arrest_date": {"month": "3", "year": "2021", "day": "20"},
            "name_pres_judge": "Abhijit Ray",
            "public_prosecutor_name": "Raghu Sen ",
            "starting_date": {"month": "3", "year": "2021", "day": "21"},
            "expected_completion_date": {"month":"3", "year":"2021", "day":"30"},
            "hearing_slot":"1",
            "hearing_date":{"month": "3", "year": "2021", "day": "21"}
        }
    )
    #CASE C
    new_case = enter_details_into_db(
        {
            "def_name": "C",
            "def_addr": "CVB",
            "crime_type": "arson",
            "crime_date": {"month": "3", "year": "2021", "day": "15"},
            "crime_loc": "Salt Lake",
            "arresting_off_name": " DCV",
            "arrest_date": {"month": "3", "year": "2021", "day": "20"},
            "name_pres_judge": "iop",
            "public_prosecutor_name": "SDC",
            "starting_date": {"month": "3", "year": "2021", "day": "21"},
            "expected_completion_date": {"month":"3", "year":"2021", "day":"30"},
            "hearing_slot":"3",
            "hearing_date":{"month": "3", "year": "2021", "day": "21"}
        }
    )
    #CASE D
    new_case = enter_details_into_db(
        {
            "def_name": "D",
            "def_addr": "DEF",
            "crime_type": "murder",
            "crime_date": {"month": "3", "year": "2021", "day": "15"},
            "crime_loc": "Park Street",
            "arresting_off_name": "ioptestkey",
            "arrest_date": {"month": "3", "year": "2021", "day": "20"},
            "name_pres_judge": "Raghu Sen",
            "public_prosecutor_name": "Ranjan Bose",
            "starting_date": {"month": "3", "year": "2021", "day": "19"},
            "expected_completion_date": {"month":"3", "year":"2021", "day":"30"},
            "hearing_slot":"5",
            "hearing_date":{"month": "3", "year": "2021", "day": "21"}
           }
    )
    #add more detalis about cases
    adj = adjournment_details_add({'cin':"1","reason":"Not Complete"})
    # print(adj)
    schedule = schedule_case({"cin":"1","slot":"2","date":{"month": "3", "year": "2021", "day": "4"}})
    # print(schedule)
    adj = adjournment_details_add({'cin':"1","reason":"More evidence required"})
    # print(adj)

    adj = adjournment_details_add({'cin':"2","reason":"Not Complete"})
    schedule = schedule_case({"cin":"2","slot":"3","date":{"month": "3", "year": "2021", "day": "22"}})
    adj = adjournment_details_add({'cin':"2","reason":"More evidence required"})
    schedule = schedule_case({"cin":"2","slot":"1","date":{"month": "3", "year": "2021", "day": "26"}})
    
    adj = adjournment_details_add({'cin':"3","reason":"Not Complete"})
    schedule = schedule_case({"cin":"3","slot":"1","date":{"month": "3", "year": "2021", "day": "22"}})
    # adj = adjournment_details_add({'cin':"3","reason":"More evidence required"})
    close = close_case({'cin':"3",'case_summary':"closed"})
    # print(close)

    adj = adjournment_details_add({'cin':"4","reason":"Not Complete"})
    schedule = schedule_case({"cin":"4","slot":"4","date":{"month": "3", "year": "2021", "day": "24"}})
    adj = adjournment_details_add({'cin':"4","reason":"More evidence required"})
    
    close = close_case({'cin':"4",'case_summary':"closed"})