def test_prepare_bteq_script(self): # Given hook = TtuHook(ttu_conn_id='ttu_default') # When bteq_file = hook._prepare_bteq_script( self._simple_bteq, hook.get_conn()['host'], hook.get_conn()['login'], hook.get_conn()['password'], hook.get_conn()['bteq_output_width'], hook.get_conn()['bteq_session_encoding'], hook.get_conn()['bteq_quit_zero']) # Then expected_bteq_file = (".LOGON localhost/login,password;\n" ".SET WIDTH 65531;\n" ".SET SESSION CHARSET 'ASCII';\n" "SELECT CURRENT_DATE;\n" ".IF ERRORCODE <> 0 THEN .QUIT 0300;\n" ".LOGOFF;\n" ".EXIT;") self.assertEqual(expected_bteq_file, bteq_file)
def test_build_bteq_file(self): # Given hook = TtuHook(ttu_conn_id='ttu_default') conn = hook.get_conn() # When bteq = hook._prepare_bteq_script(self._simple_bteq, conn['host'], conn['login'], conn['password'], conn['bteq_output_width'], conn['bteq_session_encoding'], conn['bteq_quit_zero'] ) # Then expected_bteq = """ .LOGON localhost/login, .SET WIDTH 65531; .SET SESSION CHARSET 'ASCII'; SELECT CURRENT_DATE; .IF ERRORCODE <> 0 THEN .QUIT 0300; .QUIT 0; """ self.assertEqual(expected_bteq, expected_bteq)