Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Josehpequeno committed Jun 18, 2024
1 parent b5a2f88 commit 8eacf6a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 15 deletions.
8 changes: 3 additions & 5 deletions api/handlers/documentsHandlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ func TestCreateDocumentHandler(t *testing.T) {
fmt.Println(err) //print the error if obtained
}
filepath := strings.Split(directory, "document-manager")[0] + "document-manager/documents/" + "file.pdf"
// _, fileErr := os.Create(filepath)
// assert.Nil(t, fileErr)

newDocument := models.Document{
Title: "Test Document",
Expand All @@ -111,11 +109,11 @@ func TestCreateDocumentHandler(t *testing.T) {
writer := multipart.NewWriter(&b)

// Adicionar o JSON como um campo do formulário
err = writer.WriteField("Title", newDocument.Title)
err = writer.WriteField("title", newDocument.Title)
assert.Nil(t, err)
err = writer.WriteField("OwnerId", newDocument.OwnerID)
err = writer.WriteField("owner_id", newDocument.OwnerID)
assert.Nil(t, err)
err = writer.WriteField("OwnerName", newDocument.OwnerName)
err = writer.WriteField("owner_name", newDocument.OwnerName)
assert.Nil(t, err)
// Abrir o arquivo PDF
file, err := os.Open(filepath)
Expand Down
2 changes: 1 addition & 1 deletion database/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func getDSNFromEnv() string {

// Adicione verificações para garantir que os valores não estejam vazios
if dbHost == "" || dbPort == "" || dbUser == "" || dbPassword == "" || dbName == "" {
log.Fatal("Alguma variável de ambiente do banco de dados está ausente ou vazia.")
log.Fatal("Some database environment variable is missing or empty.", dbHost, dbPort, dbUser, dbPassword, dbName)
}

return "host=" + dbHost + " user=" + dbUser + " password=" + dbPassword + " dbname=" + dbName + " port=" + dbPort + " sslmode=disable TimeZone=America/Fortaleza"
Expand Down
3 changes: 0 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ require (
github.com/cloudwego/base64x v0.1.4 // indirect
github.com/cloudwego/iasm v0.2.0 // indirect
github.com/jackc/puddle/v2 v2.2.1 // indirect
github.com/phpdave11/gofpdi v1.0.14-0.20211212211723-1f10f9844311 // indirect
github.com/pkg/errors v0.8.1 // indirect
github.com/signintech/gopdf v0.25.1 // indirect
golang.org/x/sync v0.1.0 // indirect
)

Expand Down
6 changes: 0 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,10 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/pelletier/go-toml/v2 v2.2.1 h1:9TA9+T8+8CUCO2+WYnDLCgrYi9+omqKXyjDtosvtEhg=
github.com/pelletier/go-toml/v2 v2.2.1/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
github.com/phpdave11/gofpdi v1.0.14-0.20211212211723-1f10f9844311 h1:zyWXQ6vu27ETMpYsEMAsisQ+GqJ4e1TPvSNfdOPF0no=
github.com/phpdave11/gofpdi v1.0.14-0.20211212211723-1f10f9844311/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/signintech/gopdf v0.25.1 h1:6llKXfxY6YyviuPfHJ9PrlSgxslutL45+yyTbJKj8hs=
github.com/signintech/gopdf v0.25.1/go.mod h1:d23eO35GpEliSrF22eJ4bsM3wVeQJTjXTHq5x5qGKjA=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
Expand Down

0 comments on commit 8eacf6a

Please sign in to comment.