@@ -29,10 +29,10 @@ func TestGPGKeys(t *testing.T) {
2929 results []int
3030 }{
3131 {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 },
3333 },
3434 {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 }},
3636 }
3737
3838 for _ , tc := range tt {
@@ -60,7 +60,7 @@ func TestGPGKeys(t *testing.T) {
6060 t .Run ("CreateValidGPGKey" , func (t * testing.T ) {
6161 testCreateValidGPGKey (t , tc .makeRequest , tc .token , tc .results [6 ])
6262 })
63- t .Run ("CreateValidSecondaryEmailGPGKey " , func (t * testing.T ) {
63+ t .Run ("CreateValidSecondaryEmailGPGKeyNotActivated " , func (t * testing.T ) {
6464 testCreateValidSecondaryEmailGPGKey (t , tc .makeRequest , tc .token , tc .results [7 ])
6565 })
6666 })
@@ -74,6 +74,7 @@ func TestGPGKeys(t *testing.T) {
7474 req := NewRequest (t , "GET" , "/api/v1/user/gpg_keys?token=" + token ) //GET all keys
7575 resp := session .MakeRequest (t , req , http .StatusOK )
7676 DecodeJSON (t , resp , & keys )
77+ assert .Len (t , keys , 1 )
7778
7879 primaryKey1 := keys [0 ] //Primary key 1
7980 assert .EqualValues (t , "38EA3BCED732982C" , primaryKey1 .KeyID )
@@ -85,12 +86,6 @@ func TestGPGKeys(t *testing.T) {
8586 assert .EqualValues (t , "70D7C694D17D03AD" , subKey .KeyID )
8687 assert .Empty (t , subKey .Emails )
8788
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-
9489 var key api.GPGKey
9590 req = NewRequest (t , "GET" , "/api/v1/user/gpg_keys/" + strconv .FormatInt (primaryKey1 .ID , 10 )+ "?token=" + token ) //Primary key 1
9691 resp = session .MakeRequest (t , req , http .StatusOK )
@@ -105,15 +100,6 @@ func TestGPGKeys(t *testing.T) {
105100 DecodeJSON (t , resp , & key )
106101 assert .EqualValues (t , "70D7C694D17D03AD" , key .KeyID )
107102 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-
117103 })
118104
119105 //Check state after basic add
0 commit comments