Skip to content

Commit

Permalink
add test files
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewrites committed Mar 12, 2024
1 parent 7dad035 commit b0e847d
Show file tree
Hide file tree
Showing 3 changed files with 922 additions and 2 deletions.
48 changes: 46 additions & 2 deletions tdvt/test/tdvt_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1183,25 +1183,69 @@ def test_map_user_cols_to_test_cols_missing_t0(self):
class MangleTest(unittest.TestCase):

with open('tool_test/tds/cast_calcs.tde.tds', 'r') as f:
new_lines = updated_tds_as_str(f, 'postgres_connection')
new_lines = updated_tds_as_str(f, 'sqlserver_connection')

with open('tool_test/tds/cast_calcs.postgres.tds', 'r') as postgres:
postgres_tds = updated_tds_as_str(postgres, 'postgres_connection')

with open('tool_test/tds/cast_calcs.hana.tds', 'r') as hana:
hana_tds = updated_tds_as_str(hana, 'hana_connection')


def test_mangletds_tdvtconnection(self):

self.assertIn(
"<connection tdvtconnection='postgres_connection' class='sqlserver' dbname='TestV1' odbc-native-protocol='yes' one-time-sql='' server='mssql2014' username='test' />",
"<connection tdvtconnection='sqlserver_connection' authentication='sqlserver' class='sqlserver' dbname='TestV1' odbc-native-protocol='yes' one-time-sql='' server='mssql2014' username='test' />",
self.new_lines
)
self.assertIn(
"<connection tdvtconnection='postgres_connection' authentication='username-password' class='postgres' dbname='TestV1' one-time-sql='' port='1234' server='postgres.server' username='test' />",
self.postgres_tds
)
self.assertIn(
"<connection tdvtconnection='hana_connection' authentication='username-password' class='saphana' connection-type='SingleNode' one-time-sql='' port='11235' schema='TESTV1' server='hana.harvey.hamster' sslcert='' sslmode='' username='harvey_wonder_hamster' workgroup-auth-mode=''>",
self.hana_tds
)

def test_mangletds_relation_connection(self):
self.assertIn(
"<relation connection='leaf' name='Calcs' table='[dbo].[Calcs]' type='table' />",
self.new_lines
)
self.assertIn(
"<relation connection='leaf' name='Calcs' table='[public].[Calcs]' type='table' />",
self.postgres_tds
)
self.assertIn(
"<_.fcp.ObjectModelEncapsulateLegacy.false...relation connection='leaf' name='Calcs' table='[public].[Calcs]' type='table' />",
self.postgres_tds
)
self.assertIn(
"<_.fcp.ObjectModelEncapsulateLegacy.true...relation connection='leaf' name='Calcs' table='[public].[Calcs]' type='table' />",
self.postgres_tds
)
self.assertIn(
"<relation connection='leaf' name='Calcs' table='[TESTV1].[Calcs]' type='table' />",
self.hana_tds
)
self.assertIn(
"<_.fcp.ObjectModelEncapsulateLegacy.false...relation connection='leaf' name='Calcs' table='[TESTV1].[Calcs]' type='table' />",
self.hana_tds
)

def test_mangletds_named_connection(self):
self.assertIn(
"<named-connection caption='mssql2014' name='leaf'>",
self.new_lines
)
self.assertIn(
"<named-connection caption='postgres.server' name='leaf'>",
self.postgres_tds
)
self.assertIn(
"<named-connection name='leaf'>",
self.hana_tds
)

class TestOutputFilesTest(unittest.TestCase):
good_test_results = TestOutputFiles()
Expand Down
Loading

0 comments on commit b0e847d

Please sign in to comment.