mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-08 08:32:16 +01:00
* 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
36 lines
770 B
Go
36 lines
770 B
Go
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 TestOffice(t *testing.T) {
|
|
c := &Client{Hostname: "http://localhost:3000"}
|
|
req, err := NewOfficeRequest(test.OfficeTestFilePath(t, "document.docx"))
|
|
require.Nil(t, err)
|
|
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 TestConcurrentOffice(t *testing.T) {
|
|
for i := 0; i < 10; i++ {
|
|
go func() {
|
|
TestOffice(t)
|
|
}()
|
|
}
|
|
}
|