generate token functions to share common names (#3576)

This commit is contained in:
Chris Hoffman
2017-11-13 15:44:26 -05:00
committed by GitHub
parent 8aeea21416
commit def7b5c510
6 changed files with 45 additions and 23 deletions

View File

@@ -32,6 +32,7 @@ func TestSysGenerateRootAttempt_Status(t *testing.T) {
"progress": json.Number("0"),
"required": json.Number("3"),
"complete": false,
"encoded_token": "",
"encoded_root_token": "",
"pgp_fingerprint": "",
"nonce": "",
@@ -66,6 +67,7 @@ func TestSysGenerateRootAttempt_Setup_OTP(t *testing.T) {
"progress": json.Number("0"),
"required": json.Number("3"),
"complete": false,
"encoded_token": "",
"encoded_root_token": "",
"pgp_fingerprint": "",
}
@@ -87,6 +89,7 @@ func TestSysGenerateRootAttempt_Setup_OTP(t *testing.T) {
"progress": json.Number("0"),
"required": json.Number("3"),
"complete": false,
"encoded_token": "",
"encoded_root_token": "",
"pgp_fingerprint": "",
}
@@ -120,6 +123,7 @@ func TestSysGenerateRootAttempt_Setup_PGP(t *testing.T) {
"progress": json.Number("0"),
"required": json.Number("3"),
"complete": false,
"encoded_token": "",
"encoded_root_token": "",
"pgp_fingerprint": "816938b8a29146fbe245dd29e7cbaf8e011db793",
}
@@ -156,6 +160,7 @@ func TestSysGenerateRootAttempt_Cancel(t *testing.T) {
"progress": json.Number("0"),
"required": json.Number("3"),
"complete": false,
"encoded_token": "",
"encoded_root_token": "",
"pgp_fingerprint": "",
}
@@ -183,6 +188,7 @@ func TestSysGenerateRootAttempt_Cancel(t *testing.T) {
"progress": json.Number("0"),
"required": json.Number("3"),
"complete": false,
"encoded_token": "",
"encoded_root_token": "",
"pgp_fingerprint": "",
"nonce": "",
@@ -282,9 +288,13 @@ func TestSysGenerateRoot_Update_OTP(t *testing.T) {
testResponseBody(t, resp, &actual)
}
if actual["encoded_root_token"] == nil {
if actual["encoded_token"] == nil || actual["encoded_token"] == "" {
t.Fatalf("no encoded token found in response")
}
if actual["encoded_root_token"] == nil || actual["encoded_root-token"] == "" {
t.Fatalf("no encoded root token found in response")
}
expected["encoded_token"] = actual["encoded_token"]
expected["encoded_root_token"] = actual["encoded_root_token"]
if !reflect.DeepEqual(actual, expected) {
@@ -372,9 +382,13 @@ func TestSysGenerateRoot_Update_PGP(t *testing.T) {
testResponseBody(t, resp, &actual)
}
if actual["encoded_root_token"] == nil {
if actual["encoded_token"] == nil || actual["encoded_token"] == "" {
t.Fatalf("no encoded token found in response")
}
if actual["encoded_root_token"] == nil || actual["encoded_root-token"] == "" {
t.Fatalf("no encoded root token found in response")
}
expected["encoded_token"] = actual["encoded_token"]
expected["encoded_root_token"] = actual["encoded_root_token"]
if !reflect.DeepEqual(actual, expected) {