@@ -27,6 +27,12 @@ func TestViewUser(t *testing.T) {
2727
2828 req := NewRequest (t , "GET" , "/user2" )
2929 MakeRequest (t , req , http .StatusOK )
30+
31+ req = NewRequest (t , "GET" , "/user2.keys" )
32+ resp := MakeRequest (t , req , http .StatusOK )
33+ assert .Equal (t , `# Gitea isn't a key server. The keys are exported as the user uploaded and might not have been fully verified.
34+ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDWVj0fQ5N8wNc0LVNA41wDLYJ89ZIbejrPfg/avyj3u/ZohAKsQclxG4Ju0VirduBFF9EOiuxoiFBRr3xRpqzpsZtnMPkWVWb+akZwBFAx8p+jKdy4QXR/SZqbVobrGwip2UjSrri1CtBxpJikojRIZfCnDaMOyd9Jp6KkujvniFzUWdLmCPxUE9zhTaPu0JsEP7MW0m6yx7ZUhHyfss+NtqmFTaDO+QlMR7L2QkDliN2Jl3Xa3PhuWnKJfWhdAq1Cw4oraKUOmIgXLkuiuxVQ6mD3AiFupkmfqdHq6h+uHHmyQqv3gU+/sD8GbGAhf6ftqhTsXjnv1Aj4R8NoDf9BS6KRkzkeun5UisSzgtfQzjOMEiJtmrep2ZQrMGahrXa+q4VKr0aKJfm+KlLfwm/JztfsBcqQWNcTURiCFqz+fgZw0Ey/de0eyMzldYTdXXNRYCKjs9bvBK+6SSXRM7AhftfQ0ZuoW5+gtinPrnmoOaSCEJbAiEiTO/BzOHgowiM=
35+ ` , resp .Body .String ())
3036}
3137
3238func TestRenameUsername (t * testing.T ) {
@@ -194,8 +200,17 @@ func TestRenameReservedUsername(t *testing.T) {
194200
195201func TestExportUserGPGKeys (t * testing.T ) {
196202 defer tests .PrepareTestEnv (t )()
203+ testExportUserGPGKeys := func (t * testing.T , user , expected string ) {
204+ session := loginUser (t , user )
205+ t .Logf ("Testing username %s export gpg keys" , user )
206+ req := NewRequest (t , "GET" , "/" + user + ".gpg" )
207+ resp := session .MakeRequest (t , req , http .StatusOK )
208+ assert .Equal (t , expected , resp .Body .String ())
209+ }
210+
197211 // Export empty key list
198212 testExportUserGPGKeys (t , "user1" , `-----BEGIN PGP PUBLIC KEY BLOCK-----
213+ Comment: Gitea isn't a key server. The keys are exported as the user uploaded and might not have been fully verified.
199214Note: This user hasn't uploaded any GPG keys.
200215
201216
@@ -237,6 +252,7 @@ GrE0MHOxUbc9tbtyk0F1SuzREUBH
237252-----END PGP PUBLIC KEY BLOCK-----` )
238253 // Export new key
239254 testExportUserGPGKeys (t , "user1" , `-----BEGIN PGP PUBLIC KEY BLOCK-----
255+ Comment: Gitea isn't a key server. The keys are exported as the user uploaded and might not have been fully verified.
240256
241257xsBNBFyy/VUBCADJ7zbM20Z1RWmFoVgp5WkQfI2rU1Vj9cQHes9i42wVLLtcbPeo
242258QzubgzvMPITDy7nfWxgSf83E23DoHQ1ACFbQh/6eFSRrjsusp3YQ/08NSfPPbcu8
@@ -268,15 +284,6 @@ GrE0MHOxUbc9tbtyk0F1SuzREUBH
268284-----END PGP PUBLIC KEY BLOCK-----` )
269285}
270286
271- func testExportUserGPGKeys (t * testing.T , user , expected string ) {
272- session := loginUser (t , user )
273- t .Logf ("Testing username %s export gpg keys" , user )
274- req := NewRequest (t , "GET" , "/" + user + ".gpg" )
275- resp := session .MakeRequest (t , req , http .StatusOK )
276- // t.Log(resp.Body.String())
277- assert .Equal (t , expected , resp .Body .String ())
278- }
279-
280287func TestGetUserRss (t * testing.T ) {
281288 defer tests .PrepareTestEnv (t )()
282289
0 commit comments