Commit 0ac4088 1 parent 77a9007 commit 0ac4088 Copy full SHA for 0ac4088
File tree 1 file changed +14
-0
lines changed
1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import (
14
14
"github.com/uc-cdis/cohort-middleware/tests"
15
15
"github.com/uc-cdis/cohort-middleware/utils"
16
16
"github.com/uc-cdis/cohort-middleware/version"
17
+ "gorm.io/gorm"
17
18
)
18
19
19
20
var testSourceId = tests .GetTestSourceId ()
@@ -1603,3 +1604,16 @@ func TestExecSQLError(t *testing.T) {
1603
1604
t .Errorf ("Panic should have occurred due to SQL Error" )
1604
1605
1605
1606
}
1607
+
1608
+ func TestTableExists (t * testing.T ) {
1609
+ setUp (t )
1610
+ session := tests .GetResultsDataSource ().Db .Session (& gorm.Session {})
1611
+ exists := utils .TableExists (session , tests .GetResultsDataSource ().Schema + ".cohort" )
1612
+ if ! exists {
1613
+ t .Errorf ("Expected 'cohort' table to exist" )
1614
+ }
1615
+ exists = utils .TableExists (session , "cohort_non_existing_table" )
1616
+ if exists {
1617
+ t .Errorf ("Did NOT expect 'cohort_non_existing_table' to exist" )
1618
+ }
1619
+ }
You can’t perform that action at this time.
0 commit comments