We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
TestCopyErrors
1 parent 8188c59 commit b4b35b1Copy full SHA for b4b35b1
internal/pgengine/copy_test.go
@@ -5,6 +5,7 @@ import (
5
"os"
6
"testing"
7
8
+ "github.com/cybertec-postgresql/pg_timetable/internal/pgengine"
9
"github.com/stretchr/testify/assert"
10
)
11
@@ -34,3 +35,13 @@ func TestCopyToFile(t *testing.T) {
34
35
assert.True(t, cnt == 5, "Should copy exactly 5 rows")
36
assert.NoError(t, os.RemoveAll("test.csv"), "Test output should be removed")
37
}
38
+
39
+func TestCopyErrors(t *testing.T) {
40
+ initmockdb(t)
41
+ pge := pgengine.NewDB(mockPool, "pgengine_unit_test")
42
+ defer mockPool.Close()
43
+ _, err := pge.CopyFromFile(context.Background(), "foo", "boo")
44
+ assert.Error(t, err, "Should fail in pgxmock Acquire()")
45
+ _, err = pge.CopyToFile(context.Background(), "foo", "boo")
46
47
+}
0 commit comments