-
-
Notifications
You must be signed in to change notification settings - Fork 931
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
127 additions
and
21 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
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package lookup | ||
|
||
import ( | ||
_ "embed" | ||
"encoding/json" | ||
"github.com/ory/x/assertx" | ||
"github.com/ory/x/sqlxx" | ||
"testing" | ||
"time" | ||
) | ||
|
||
//go:embed fixtures/node.json | ||
var fixtureNode []byte | ||
|
||
func TestToNode(t *testing.T) { | ||
c := CredentialsConfig{RecoveryCodes: []RecoveryCode{ | ||
{Code: "foo", UsedAt: sqlxx.NullTime(time.Unix(1629199958, 0))}, | ||
{Code: "bar"}, | ||
{Code: "baz"}, | ||
{Code: "oof", UsedAt: sqlxx.NullTime(time.Unix(1629199968, 0))}, | ||
}} | ||
|
||
assertx.EqualAsJSON(t, json.RawMessage(fixtureNode), c.ToNode()) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
"type": "text", | ||
"group": "lookup_secret", | ||
"attributes": { | ||
"text": { | ||
"id": 1050015, | ||
"text": "used, bar, baz, used", | ||
"type": "info", | ||
"context": { | ||
"secrets": [ | ||
{ | ||
"id": 1050014, | ||
"text": "Secret was used at 2021-08-17 13:32:38 +0200 CEST", | ||
"type": "info", | ||
"context": { | ||
"used_at": "2021-08-17T13:32:38+02:00" | ||
} | ||
}, | ||
{ | ||
"id": 1050009, | ||
"text": "bar", | ||
"type": "info", | ||
"context": { | ||
"secret": "bar" | ||
} | ||
}, | ||
{ | ||
"id": 1050009, | ||
"text": "baz", | ||
"type": "info", | ||
"context": { | ||
"secret": "baz" | ||
} | ||
}, | ||
{ | ||
"id": 1050014, | ||
"text": "Secret was used at 2021-08-17 13:32:48 +0200 CEST", | ||
"type": "info", | ||
"context": { | ||
"used_at": "2021-08-17T13:32:48+02:00" | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
"id": "lookup_secret_codes" | ||
}, | ||
"messages": [], | ||
"meta": { | ||
"label": { | ||
"id": 1050010, | ||
"text": "These are your back up recovery codes. Please keep them in a safe place!", | ||
"type": "info" | ||
} | ||
} | ||
} |
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