Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Forceu committed Feb 3, 2025
1 parent a7a31c3 commit 862ca18
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
7 changes: 4 additions & 3 deletions internal/models/ApiKey.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package models

import "time"
import (
"time"
)

const (
// ApiPermView is the permission for viewing metadata of all uploaded files
Expand Down Expand Up @@ -53,8 +55,7 @@ func (key *ApiKey) GetReadableDate() string {

// GetRedactedId returns a redacted version of the API key
func (key *ApiKey) GetRedactedId() string {
return key.Id[0:2] + "**************************" + key.Id[28:]

return key.Id[0:2] + "**************************" + key.Id[len(key.Id)-2:]
}

// GrantPermission sets one or more permissions
Expand Down
10 changes: 5 additions & 5 deletions internal/test/testconfiguration/TestConfiguration.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,36 +256,36 @@ func writeApiKeys() {
FriendlyName: "First Key",
Permissions: models.ApiPermAll, // TODO
UserId: 5,
PublicId: "Queime3iun",
PublicId: "taiyeo6uLie6nu6eip0ieweiM5mahv",
})
database.SaveApiKey(models.ApiKey{
Id: "validkeyid7",
FriendlyName: "Key for uid 7",
Permissions: models.ApiPermAll, // TODO
UserId: 7,
PublicId: "Queime3iun7",
PublicId: "vu0eemi8eehaisuth3pahDai2eo6ze",
})
database.SaveApiKey(models.ApiKey{
Id: "GAh1IhXDvYnqfYLazWBqMB9HSFmNPO",
FriendlyName: "Second Key",
LastUsed: 1620671580,
Permissions: models.ApiPermAll, // TODO
UserId: 5,
PublicId: "Xoox8chaiX",
PublicId: "yaeVohng1ohNohsh1vailizeil5ka5",
})
database.SaveApiKey(models.ApiKey{
Id: "jiREglQJW0bOqJakfjdVfe8T1EM8n8",
FriendlyName: "Unnamed Key",
Permissions: models.ApiPermAll, // TODO
UserId: 5,
PublicId: "giD8peitoo",
PublicId: "ahYie4ophoo5OoGhahCe1neic6thah",
})
database.SaveApiKey(models.ApiKey{
Id: "okeCMWqhVMZSpt5c1qpCWhKvJJPifb",
FriendlyName: "Unnamed Key",
Permissions: models.ApiPermAll, // TODO
UserId: 5,
PublicId: "gahNg6geaf",
PublicId: "ugoo0roowoanahthei7ohSail5OChu",
})
}

Expand Down
1 change: 1 addition & 0 deletions internal/webserver/Webserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ func TestPostUpload(t *testing.T) {
{"filename", "fileupload.jpg"},
{"filecontenttype", "test-content"},
{"filesize", "50"},
{"nonblocking", "true"},
},
RequiredContent: []string{"{\"result\":\"OK\"}"},
Cookies: []test.Cookie{{
Expand Down

0 comments on commit 862ca18

Please sign in to comment.