forked from smithoss/gonymizer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mapper_test.go
39 lines (31 loc) · 1.04 KB
/
mapper_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package gonymizer
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestGenerateConfigSkeleton(t *testing.T) {
conf := GetTestDbConf(TestDb)
// Dump testing database
excludeTables := append(TestExcludeTable, TestExcludeTableData...)
skeleton, err := GenerateConfigSkeleton(conf, TestSchemaPrefix, TestSchemas, excludeTables)
require.Nil(t, err)
_, err = GenerateConfigSkeleton(conf, TestSchemaPrefix, []string{}, excludeTables)
require.Nil(t, err)
_, err = GenerateConfigSkeleton(conf, TestSchemaPrefix, TestSchemas, []string{})
require.Nil(t, err)
err = WriteConfigSkeleton(skeleton, TestMapOutputFile)
require.Nil(t, err)
err = WriteConfigSkeleton(skeleton, "")
require.NotNil(t, err)
}
func TestLoadConfigSkeleton(t *testing.T) {
dbmap, err := LoadConfigSkeleton(TestMapFile)
require.Nil(t, err)
require.Nil(t, dbmap.Validate())
_, err = LoadConfigSkeleton(TestDbFile)
require.NotNil(t, err)
_, err = LoadConfigSkeleton("")
require.NotNil(t, err)
_, err = LoadConfigSkeleton("/dev/null")
require.NotNil(t, err)
}