-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LEAF 4455 test - add tests for display of inactive accts, filled and …
…empty metadata
- Loading branch information
1 parent
fa9e520
commit 62a24b6
Showing
3 changed files
with
65 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6287,7 +6287,7 @@ INSERT INTO `records` (`recordID`, `date`, `serviceID`, `userID`, `title`, `prio | |
(10, 1694021465, 0, 'tester', 'TestFormWorkflow_ApplyAction', 0, 'Submitted', 1694021485, 0, 0, 1, '{\"email\": \"[email protected]\", \"lastName\": \"Tester\", \"userName\": \"tester\", \"firstName\": \"Tester\", \"middleName\": \"\"}'), | ||
(11, 1694021465, 0, 'tester', 'TestFormQuery_Employee_Format__Orgchart_Has_Expected_Values', 0, 'Submitted', 1694021485, 0, 0, 1, '{\"email\": \"[email protected]\", \"lastName\": \"Tester\", \"userName\": \"tester\", \"firstName\": \"Tester\", \"middleName\": \"\"}'), | ||
(12, 1694021465, 0, 'tester', 'TestFormQuery_InitiatorName', 0, 'Submitted', 1694021485, 0, 0, 1, '{\"email\": \"[email protected]\", \"lastName\": \"Tester\", \"userName\": \"tester\", \"firstName\": \"Tester\", \"middleName\": \"\"}'), | ||
(13, 1694021465, 0, 'tester', 'Available for test case', 0, 'Submitted', 1694021485, 0, 0, 1, '{\"email\": \"[email protected]\", \"lastName\": \"Tester\", \"userName\": \"tester\", \"firstName\": \"Tester\", \"middleName\": \"\"}'), | ||
(13, 1694021465, 0, 'tester_disabled', 'TestFormQuery_Initiator_Disabled__Empty_Metadata', 0, 'Submitted', 1694021485, 0, 0, 1, '{\"email\": \"\", \"lastName\": \"\", \"userName\": \"\", \"firstName\": \"\", \"middleName\": \"\"}'), | ||
(14, 1694021465, 0, 'tester', 'Available for test case', 0, 'Submitted', 1694021485, 0, 0, 1, '{\"email\": \"[email protected]\", \"lastName\": \"Tester\", \"userName\": \"tester\", \"firstName\": \"Tester\", \"middleName\": \"\"}'), | ||
(15, 1694021465, 0, 'tester', 'Available for test case', 0, 'Submitted', 1694021485, 0, 0, 1, '{\"email\": \"[email protected]\", \"lastName\": \"Tester\", \"userName\": \"tester\", \"firstName\": \"Tester\", \"middleName\": \"\"}'), | ||
(16, 1694021465, 0, 'tester', 'Available for test case', 0, 'Submitted', 1694021485, 0, 0, 1, '{\"email\": \"[email protected]\", \"lastName\": \"Tester\", \"userName\": \"tester\", \"firstName\": \"Tester\", \"middleName\": \"\"}'), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -323,51 +323,42 @@ func TestFormQuery_Records_UserMetadata__Has_Expected_Values(t *testing.T) { | |
Email: "Risá[email protected]", | ||
UserName: "vtrigzcristal", | ||
} | ||
|
||
//post new request under a username | ||
postData := url.Values{} | ||
postData.Set("CSRFToken", CsrfToken) | ||
postData.Set("initiator", "vtrigzcristal") | ||
_, _ = client.PostForm(RootURL+`api/form/12/initiator`, postData) | ||
|
||
//confirm firstName, lastName and userMetadata have expected values | ||
q := `api/form/query/?q={"terms":[{"id":"categoryID","operator":"=","match":"form_5ea07","gate":"AND"},{"id":"deleted","operator":"=","match":0,"gate":"AND"}],"joins":["initiatorName"],"sort":{}}` | ||
xFilter := `&x-filterData=recordID,lastName,firstName,userMetadata` | ||
res, _ := getFormQuery(RootURL + q + xFilter) | ||
recordID := 12 | ||
|
||
formRecord := res[recordID] | ||
initiatorOrgchart := formRecord.UserMetadata | ||
formRecord := res[12] | ||
initiatorMetadata := formRecord.UserMetadata | ||
|
||
gotFirstName := res[recordID].FirstName | ||
gotLastName := res[recordID].LastName | ||
gotFirstName := formRecord.FirstName | ||
gotLastName := formRecord.LastName | ||
|
||
gotMetadataFirstName := initiatorOrgchart.FirstName | ||
gotMetadataLastName := initiatorOrgchart.LastName | ||
gotMetadataMiddle := initiatorOrgchart.MiddleName | ||
gotMetadataEmail := initiatorOrgchart.Email | ||
gotMetadataUserName := initiatorOrgchart.UserName | ||
gotMetadataFirstName := initiatorMetadata.FirstName | ||
gotMetadataLastName := initiatorMetadata.LastName | ||
gotMetadataMiddle := initiatorMetadata.MiddleName | ||
gotMetadataEmail := initiatorMetadata.Email | ||
gotMetadataUserName := initiatorMetadata.UserName | ||
|
||
wantFirst := mock_orgchart_employee.FirstName | ||
wantLast := mock_orgchart_employee.LastName | ||
wantMiddle := mock_orgchart_employee.MiddleName | ||
wantEmail := mock_orgchart_employee.Email | ||
wantUserName := mock_orgchart_employee.UserName | ||
|
||
//record firstName lastName fields. These are extracted from JSON userMetadata and should also match. | ||
if !cmp.Equal(gotFirstName, wantFirst) { | ||
t.Errorf("Record first name got = %v, want = %v", gotFirstName, wantFirst) | ||
} | ||
if !cmp.Equal(gotLastName, wantLast) { | ||
t.Errorf("Record last name got = %v, want = %v", gotLastName, wantLast) | ||
} | ||
//record userMetadata firstName lastName properties | ||
//record userMetadata properties | ||
if !cmp.Equal(gotMetadataFirstName, wantFirst) { | ||
t.Errorf("Record userMetadata first name got = %v, want = %v", gotMetadataFirstName, wantFirst) | ||
} | ||
if !cmp.Equal(gotMetadataLastName, wantLast) { | ||
t.Errorf("Record userMetadata last name got = %v, want = %v", gotMetadataLastName, wantLast) | ||
} | ||
|
||
//record userMetadata middleName email and userName properties | ||
if !cmp.Equal(gotMetadataMiddle, wantMiddle) { | ||
t.Errorf("Last name got = %v, want = %v", gotMetadataMiddle, wantMiddle) | ||
} | ||
|
@@ -377,4 +368,47 @@ func TestFormQuery_Records_UserMetadata__Has_Expected_Values(t *testing.T) { | |
if !cmp.Equal(gotMetadataUserName, wantUserName) { | ||
t.Errorf("Last name got = %v, want = %v", gotMetadataUserName, wantUserName) | ||
} | ||
|
||
//record firstName lastName fields. These are extracted from JSON userMetadata and should also match. | ||
if !cmp.Equal(gotFirstName, wantFirst) { | ||
t.Errorf("Record first name got = %v, want = %v", gotFirstName, wantFirst) | ||
} | ||
if !cmp.Equal(gotLastName, wantLast) { | ||
t.Errorf("Record last name got = %v, want = %v", gotLastName, wantLast) | ||
} | ||
|
||
//disable the account locally and confirm first and last name are still available | ||
err := DisableEmployee(RootOrgchartURL + "api/employee/11") | ||
if err != nil { | ||
t.Error(err) | ||
} | ||
res, _ = getFormQuery(RootURL + q + xFilter) | ||
formRecord = res[12] | ||
gotFirstName = formRecord.FirstName | ||
gotLastName = formRecord.LastName | ||
if !cmp.Equal(gotFirstName, wantFirst) { | ||
t.Errorf("Record first name got = %v, want = %v", gotFirstName, wantFirst) | ||
} | ||
if !cmp.Equal(gotLastName, wantLast) { | ||
t.Errorf("Record last name got = %v, want = %v", gotLastName, wantLast) | ||
} | ||
//re-enable account | ||
err = EnableLocalEmployee("11") | ||
if err != nil { | ||
t.Error(err) | ||
} | ||
|
||
//test firstName, lastName record fields for a record (#13)with empty metadata (accounts disabled prior to 12/6/2024) | ||
formRecord = res[13] | ||
gotFirstName = formRecord.FirstName | ||
gotLastName = formRecord.LastName | ||
|
||
wantFirst = "(inactive user)" | ||
wantLast = "tester_disabled" | ||
if !cmp.Equal(gotFirstName, wantFirst) { | ||
t.Errorf("Record first name got = %v, want = %v", gotFirstName, wantFirst) | ||
} | ||
if !cmp.Equal(gotLastName, wantLast) { | ||
t.Errorf("Record last name got = %v, want = %v", gotLastName, wantLast) | ||
} | ||
} |