-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: update to fit the updated code
This change update the tests to fit the changes (now depending on Identity from platform-go-middlewares). Additionally, it is used pointy methods to generate pointer to values. Signed-off-by: Alejandro Visiedo <[email protected]>
- Loading branch information
Showing
9 changed files
with
141 additions
and
160 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 |
---|---|---|
|
@@ -7,6 +7,7 @@ import ( | |
"github.com/google/go-cmp/cmp/cmpopts" | ||
"github.com/pioz/faker" | ||
"github.com/redhatinsights/platform-go-middlewares/identity" | ||
"go.openly.dev/pointy" | ||
) | ||
|
||
func TestNewAssociate(t *testing.T) { | ||
|
@@ -33,9 +34,9 @@ func TestNewAssociate(t *testing.T) { | |
description: "partial template", | ||
seed: 100, | ||
input: Associate{ | ||
Email: ptrstring("[email protected]"), | ||
GivenName: ptrstring("John"), | ||
Surname: ptrstring("Smith"), | ||
Email: pointy.String("[email protected]"), | ||
GivenName: pointy.String("John"), | ||
Surname: pointy.String("Smith"), | ||
}, | ||
want: &identity.Associate{ | ||
Email: "[email protected]", | ||
|
@@ -49,11 +50,11 @@ func TestNewAssociate(t *testing.T) { | |
description: "full template", | ||
seed: 100, | ||
input: Associate{ | ||
Email: ptrstring("[email protected]"), | ||
GivenName: ptrstring("John"), | ||
RHatUUID: ptrstring("6208f878-b405-498e-979f-e85cd68d8a18"), | ||
Role: ptrslicestring([]string{"a", "b"}), | ||
Surname: ptrstring("Smith"), | ||
Email: pointy.String("[email protected]"), | ||
GivenName: pointy.String("John"), | ||
RHatUUID: pointy.String("6208f878-b405-498e-979f-e85cd68d8a18"), | ||
Role: &[]string{"a", "b"}, | ||
Surname: pointy.String("Smith"), | ||
}, | ||
want: &identity.Associate{ | ||
Email: "[email protected]", | ||
|
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 |
---|---|---|
|
@@ -18,7 +18,7 @@ func ExampleAssociate() { | |
panic(err) | ||
} | ||
fmt.Println(string(data)) | ||
//Output: {"identity":{"associate":{"email":"[email protected]","givenName":"Cameron","rhatUUID":"00e3c758-1d7d-4ecd-98a2-997157e2d05c","Role":null,"surname":"Swift"},"auth_type":"basic-auth","employee_account_number":"02299","org_id":"41123","type":"Associate"}} | ||
//Output: {"identity":{"employee_account_number":"02299","org_id":"41123","internal":{"org_id":""},"user":{"username":"","email":"","first_name":"","last_name":"","is_active":false,"is_org_admin":false,"is_internal":false,"locale":"","user_id":""},"system":{},"associate":{"Role":null,"email":"[email protected]","givenName":"Cameron","rhatUUID":"00e3c758-1d7d-4ecd-98a2-997157e2d05c","surname":"Swift"},"x509":{"subject_dn":"","issuer_dn":""},"type":"Associate","auth_type":"basic-auth"}} | ||
} | ||
|
||
func ExampleInternal() { | ||
|
@@ -32,7 +32,7 @@ func ExampleInternal() { | |
panic(err) | ||
} | ||
fmt.Println(string(data)) | ||
//Output: {"identity":{"auth_type":"basic-auth","internal":{"auth_time":-2978345425851500500,"cross_access":false,"org_id":"08321"},"org_id":"03797","type":"Internal"}} | ||
//Output: {"identity":{"org_id":"03797","internal":{"org_id":"08321","auth_time":-2978345600000000000},"user":{"username":"","email":"","first_name":"","last_name":"","is_active":false,"is_org_admin":false,"is_internal":false,"locale":"","user_id":""},"system":{},"associate":{"Role":null,"email":"","givenName":"","rhatUUID":"","surname":""},"x509":{"subject_dn":"","issuer_dn":""},"type":"Internal","auth_type":"basic-auth"}} | ||
} | ||
|
||
func ExampleSystem() { | ||
|
@@ -46,7 +46,7 @@ func ExampleSystem() { | |
panic(err) | ||
} | ||
fmt.Println(string(data)) | ||
//Output: {"identity":{"account_number":"16398","auth_type":"basic-auth","internal":{"org_id":"57572"},"org_id":"57572","system":{"cert_type":"consumer","cluster_id":"x8LdjPo","cn":"It6P"},"type":"System"}} | ||
//Output: {"identity":{"account_number":"16398","org_id":"57572","internal":{"org_id":"57572"},"user":{"username":"","email":"","first_name":"","last_name":"","is_active":false,"is_org_admin":false,"is_internal":false,"locale":"","user_id":""},"system":{"cn":"It6P","cert_type":"consumer","cluster_id":"x8LdjPo"},"associate":{"Role":null,"email":"","givenName":"","rhatUUID":"","surname":""},"x509":{"subject_dn":"","issuer_dn":""},"type":"System","auth_type":"basic-auth"}} | ||
} | ||
|
||
func ExampleUser() { | ||
|
@@ -60,7 +60,7 @@ func ExampleUser() { | |
panic(err) | ||
} | ||
fmt.Println(string(data)) | ||
//Output: {"identity":{"auth_type":"cert-auth","internal":{"org_id":"23807"},"org_id":"23807","type":"User","user":{"email":"[email protected]","first_name":"Frankie","is_active":false,"is_internal":true,"is_org_admin":false,"last_name":"Collins","locale":"pi","user_id":"backset","username":"tycoon"}}} | ||
//Output: {"identity":{"org_id":"23807","internal":{"org_id":"23807"},"user":{"username":"tycoon","email":"[email protected]","first_name":"Frankie","last_name":"Collins","is_active":false,"is_org_admin":false,"is_internal":true,"locale":"pi","user_id":"backset"},"system":{},"associate":{"Role":null,"email":"","givenName":"","rhatUUID":"","surname":""},"x509":{"subject_dn":"","issuer_dn":""},"type":"User","auth_type":"cert-auth"}} | ||
} | ||
|
||
func ExampleX509() { | ||
|
@@ -74,5 +74,5 @@ func ExampleX509() { | |
panic(err) | ||
} | ||
fmt.Println(string(data)) | ||
//Output: {"identity":{"auth_type":"cert-auth","org_id":"23807","type":"X509","x509":{"subject_dn":"2","issuer_dn":"3sfSj"}}} | ||
//Output: {"identity":{"org_id":"23807","internal":{"org_id":""},"user":{"username":"","email":"","first_name":"","last_name":"","is_active":false,"is_org_admin":false,"is_internal":false,"locale":"","user_id":""},"system":{},"associate":{"Role":null,"email":"","givenName":"","rhatUUID":"","surname":""},"x509":{"subject_dn":"2","issuer_dn":"3sfSj"},"type":"X509","auth_type":"cert-auth"}} | ||
} |
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
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
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
Oops, something went wrong.