@@ -24,23 +24,44 @@ def login_with_drexel_connect(session: Session) -> Session:
24
24
}
25
25
26
26
# this should send the credentials and send the MFA request
27
- response = send_request (session , config .drexel_connect_base_url + form_action_path , data = login_payload , method = "POST" )
28
- assert response .status_code == 200 , "Failed to send request to Drexel Connect with username and password"
27
+ response = send_request (
28
+ session ,
29
+ config .drexel_connect_base_url + form_action_path ,
30
+ data = login_payload ,
31
+ method = "POST" ,
32
+ )
33
+ assert (
34
+ response .status_code == 200
35
+ ), "Failed to send request to Drexel Connect with username and password"
29
36
30
37
soup = BeautifulSoup (response .text , "html.parser" )
31
38
data = parse_initial_mfa_page (soup )
32
39
33
- response = send_request (session , config .drexel_connect_base_url + data ["url" ], data = data ["form-data" ], method = "POST" )
34
- assert response .status_code == 200 , "Failed to request MFA code page from Drexel Connect"
40
+ response = send_request (
41
+ session ,
42
+ config .drexel_connect_base_url + data ["url" ],
43
+ data = data ["form-data" ],
44
+ method = "POST" ,
45
+ )
46
+ assert (
47
+ response .status_code == 200
48
+ ), "Failed to request MFA code page from Drexel Connect"
35
49
json_response = response .json ()
36
50
37
51
data = {
38
52
json_response ["csrfN" ]: json_response ["csrfV" ],
39
53
"_eventId" : json_response ["actValue" ],
40
54
}
41
55
42
- response = send_request (session , config .drexel_connect_base_url + json_response ["flowExURL" ], data = data , method = "POST" )
43
- assert response .status_code == 200 , "Failed to receive MFA code page from Drexel Connect"
56
+ response = send_request (
57
+ session ,
58
+ config .drexel_connect_base_url + json_response ["flowExURL" ],
59
+ data = data ,
60
+ method = "POST" ,
61
+ )
62
+ assert (
63
+ response .status_code == 200
64
+ ), "Failed to receive MFA code page from Drexel Connect"
44
65
soup = BeautifulSoup (response .text , "html.parser" )
45
66
46
67
parsed_data = parse_final_mfa_page (soup )
@@ -53,8 +74,15 @@ def login_with_drexel_connect(session: Session) -> Session:
53
74
"j_mfaToken" : totp_code ,
54
75
}
55
76
56
- response = send_request (session , config .drexel_connect_base_url + parsed_data ["url" ], data = data , method = "POST" )
57
- assert response .status_code == 200 , "Failed to send MFA code to Drexel Connect (final step)"
77
+ response = send_request (
78
+ session ,
79
+ config .drexel_connect_base_url + parsed_data ["url" ],
80
+ data = data ,
81
+ method = "POST" ,
82
+ )
83
+ assert (
84
+ response .status_code == 200
85
+ ), "Failed to send MFA code to Drexel Connect (final step)"
58
86
59
87
return session
60
88
0 commit comments