Added unit test cases for the new flags '-allow-tables', '-allow-views', and '-allow-enums'.
This commit is contained in:
parent
bfb02acb43
commit
c35892320d
4 changed files with 319 additions and 14 deletions
|
|
@ -427,3 +427,53 @@ type Address struct {
|
|||
LastUpdate time.Time
|
||||
}
|
||||
`
|
||||
|
||||
func TestAllowTablesEnums(t *testing.T) {
|
||||
cmd := exec.Command("jet",
|
||||
"-source=SQLite",
|
||||
"-dsn=file://"+testDatabaseFilePath,
|
||||
"-allow-tables=actor,Address,CATEGORY , city ,film,rental,store",
|
||||
"-allow-views=customer_list, film_list,STAFF_LIst",
|
||||
"-path="+genDestDir)
|
||||
|
||||
cmd.Stderr = os.Stderr
|
||||
cmd.Stdout = os.Stdout
|
||||
|
||||
err := cmd.Run()
|
||||
require.NoError(t, err)
|
||||
|
||||
testutils.AssertFileNamesEqual(t, genDestDir+"/table", "actor.go", "address.go", "category.go", "city.go",
|
||||
"film.go", "rental.go", "store.go", "table_use_schema.go")
|
||||
|
||||
testutils.AssertFileNamesEqual(t, genDestDir+"/view", "customer_list.go", "film_list.go", "staff_list.go",
|
||||
"view_use_schema.go")
|
||||
|
||||
testutils.AssertFileNamesEqual(t, genDestDir+"/model", "actor.go", "address.go", "category.go", "city.go",
|
||||
"film.go", "rental.go", "store.go", "customer_list.go", "film_list.go", "staff_list.go")
|
||||
}
|
||||
|
||||
func TestAllowAndIgnoreTablesEnums(t *testing.T) {
|
||||
cmd := exec.Command("jet",
|
||||
"-source=SQLite",
|
||||
"-dsn=file://"+testDatabaseFilePath,
|
||||
"-allow-tables=actor,Address,CATEGORY , city ,film,rental,store",
|
||||
"-allow-views=customer_list, film_list,STAFF_LIst",
|
||||
"-ignore-tables=actor,CATEGORY ,store",
|
||||
"-ignore-views=customer_list",
|
||||
"-path="+genDestDir)
|
||||
|
||||
cmd.Stderr = os.Stderr
|
||||
cmd.Stdout = os.Stdout
|
||||
|
||||
err := cmd.Run()
|
||||
require.NoError(t, err)
|
||||
|
||||
testutils.AssertFileNamesEqual(t, genDestDir+"/table", "actor.go", "address.go", "category.go", "city.go",
|
||||
"film.go", "rental.go", "store.go", "table_use_schema.go")
|
||||
|
||||
testutils.AssertFileNamesEqual(t, genDestDir+"/view", "customer_list.go", "film_list.go", "staff_list.go",
|
||||
"view_use_schema.go")
|
||||
|
||||
testutils.AssertFileNamesEqual(t, genDestDir+"/model", "actor.go", "address.go", "category.go", "city.go",
|
||||
"film.go", "rental.go", "store.go", "customer_list.go", "film_list.go", "staff_list.go")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue