@@ -29,10 +29,10 @@ func TestGPGKeys(t *testing.T) {
29
29
results []int
30
30
}{
31
31
{name : "NoLogin" , makeRequest : MakeRequest , token : "" ,
32
- results : []int {http .StatusUnauthorized , http .StatusUnauthorized , http .StatusUnauthorized , http .StatusUnauthorized , http .StatusUnauthorized , http .StatusUnauthorized , http .StatusUnauthorized , http .StatusUnauthorized },
32
+ results : []int {http .StatusUnauthorized , http .StatusUnauthorized , http .StatusUnauthorized , http .StatusUnauthorized , http .StatusUnauthorized , http .StatusUnauthorized , http .StatusUnauthorized , http .StatusUnauthorized , http . StatusUnauthorized },
33
33
},
34
34
{name : "LoggedAsUser2" , makeRequest : session .MakeRequest , token : token ,
35
- results : []int {http .StatusOK , http .StatusOK , http .StatusNotFound , http .StatusNoContent , http .StatusUnprocessableEntity , http .StatusNotFound , http .StatusCreated , http .StatusCreated }},
35
+ results : []int {http .StatusOK , http .StatusOK , http .StatusNotFound , http .StatusNoContent , http .StatusUnprocessableEntity , http .StatusNotFound , http .StatusCreated , http .StatusNotFound , http . StatusCreated }},
36
36
}
37
37
38
38
for _ , tc := range tt {
@@ -60,7 +60,7 @@ func TestGPGKeys(t *testing.T) {
60
60
t .Run ("CreateValidGPGKey" , func (t * testing.T ) {
61
61
testCreateValidGPGKey (t , tc .makeRequest , tc .token , tc .results [6 ])
62
62
})
63
- t .Run ("CreateValidSecondaryEmailGPGKey " , func (t * testing.T ) {
63
+ t .Run ("CreateValidSecondaryEmailGPGKeyNotActivated " , func (t * testing.T ) {
64
64
testCreateValidSecondaryEmailGPGKey (t , tc .makeRequest , tc .token , tc .results [7 ])
65
65
})
66
66
})
@@ -74,6 +74,7 @@ func TestGPGKeys(t *testing.T) {
74
74
req := NewRequest (t , "GET" , "/api/v1/user/gpg_keys?token=" + token ) //GET all keys
75
75
resp := session .MakeRequest (t , req , http .StatusOK )
76
76
DecodeJSON (t , resp , & keys )
77
+ assert .Len (t , keys , 1 )
77
78
78
79
primaryKey1 := keys [0 ] //Primary key 1
79
80
assert .EqualValues (t , "38EA3BCED732982C" , primaryKey1 .KeyID )
@@ -85,12 +86,6 @@ func TestGPGKeys(t *testing.T) {
85
86
assert .EqualValues (t , "70D7C694D17D03AD" , subKey .KeyID )
86
87
assert .Empty (t , subKey .Emails )
87
88
88
- primaryKey2 := keys [1 ] //Primary key 2
89
- assert .EqualValues (t , "3CEF46EF40BEFC3E" , primaryKey2 .KeyID )
90
- assert .Len (t , primaryKey2 .Emails , 1 )
91
- assert .
EqualValues (
t ,
"[email protected] " ,
primaryKey2 .
Emails [
0 ].
Email )
92
- assert .False (t , primaryKey2 .Emails [0 ].Verified )
93
-
94
89
var key api.GPGKey
95
90
req = NewRequest (t , "GET" , "/api/v1/user/gpg_keys/" + strconv .FormatInt (primaryKey1 .ID , 10 )+ "?token=" + token ) //Primary key 1
96
91
resp = session .MakeRequest (t , req , http .StatusOK )
@@ -105,15 +100,6 @@ func TestGPGKeys(t *testing.T) {
105
100
DecodeJSON (t , resp , & key )
106
101
assert .EqualValues (t , "70D7C694D17D03AD" , key .KeyID )
107
102
assert .Empty (t , key .Emails )
108
-
109
- req = NewRequest (t , "GET" , "/api/v1/user/gpg_keys/" + strconv .FormatInt (primaryKey2 .ID , 10 )+ "?token=" + token ) //Primary key 2
110
- resp = session .MakeRequest (t , req , http .StatusOK )
111
- DecodeJSON (t , resp , & key )
112
- assert .EqualValues (t , "3CEF46EF40BEFC3E" , key .KeyID )
113
- assert .Len (t , key .Emails , 1 )
114
- assert .
EqualValues (
t ,
"[email protected] " ,
key .
Emails [
0 ].
Email )
115
- assert .False (t , key .Emails [0 ].Verified )
116
-
117
103
})
118
104
119
105
//Check state after basic add
0 commit comments