mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-15 20:02:15 +01:00
4.0.0 (#42)
* adding URL conversions * updating gotenberg version in documentation * pkg: input as variadic string (#39) * pkg: input as variadic string * pkg: fix link to github doc * update doc about v4 client * make doc * fixing missing variadic inputs in doc * adding more fonts * updating PHP documentation
This commit is contained in:
41
pkg/url_test.go
Normal file
41
pkg/url_test.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package gotenberg
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/thecodingmachine/gotenberg/internal/pkg/rand"
|
||||
"github.com/thecodingmachine/gotenberg/test"
|
||||
)
|
||||
|
||||
func TestURL(t *testing.T) {
|
||||
c := &Client{Hostname: "http://localhost:3000"}
|
||||
req := NewURLRequest("http://google.com")
|
||||
err := req.SetHeader(test.URLTestFilePath(t, "header.html"))
|
||||
require.Nil(t, err)
|
||||
err = req.SetFooter(test.URLTestFilePath(t, "footer.html"))
|
||||
require.Nil(t, err)
|
||||
require.Nil(t, err)
|
||||
req.SetPaperSize(A4)
|
||||
req.SetMargins(NormalMargins)
|
||||
req.SetLandscape(false)
|
||||
dirPath, err := rand.Get()
|
||||
require.Nil(t, err)
|
||||
dest := fmt.Sprintf("%s/foo.pdf", dirPath)
|
||||
err = c.Store(req, dest)
|
||||
assert.Nil(t, err)
|
||||
assert.FileExists(t, dest)
|
||||
err = os.RemoveAll(dirPath)
|
||||
assert.Nil(t, err)
|
||||
}
|
||||
|
||||
func TestConcurrentURL(t *testing.T) {
|
||||
for i := 0; i < 10; i++ {
|
||||
go func() {
|
||||
TestURL(t)
|
||||
}()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user