Пример #1
0
 def test_get_redshift_port(self):
     file_path = '/test/testconfig.ini'
     with open(self.config_path) as f:
         config_contents = f.read()
     self.fs.create_file(file_path, contents=config_contents)
     config = read_redshift_config_file(file_path)
     self.assertEqual(get_redshift_port(config), 1234)
Пример #2
0
 def test_write_redshift_config_file(self):
     file_path = '/test/testconfig.ini'
     write_redshift_config_file(file_path,
                                host='test-host',
                                user='******',
                                port=1234)
     config = read_redshift_config_file(file_path)
     self.assertEqual(config['host'], 'test-host')
     self.assertEqual(config['port'], '1234')
     self.assertEqual(config['user_name'], 'test')
Пример #3
0
 def test_read_redshift_config_file(self):
     file_path = '/test/testconfig.ini'
     with open(self.config_path) as f:
         config_contents = f.read()
     self.fs.create_file(file_path, contents=config_contents)
     config = read_redshift_config_file(file_path)
     self.assertIsNotNone(config)
     self.assertEqual(config['host'], 'test-host')
     self.assertEqual(config['port'], '1234')
     self.assertEqual(config['user_name'], 'test')
 def __init__(self) -> None:
     config_path = filepath_helper.get_redshift_config_path()
     connection_attr = config_helper.read_redshift_config_file(config_path)
     credentials = credential_helper.get_redshift_credentials(connection_attr)
     connection_attr[__CREDENTIALS__] = credentials
     super(RedshiftConnector, self).__init__(engine_name=__ENGINE_NAME__, connection_attr=connection_attr)
Пример #5
0
 def test_read_redshift_config_file_exception(self):
     file_path = '/test/testconfig.ini'
     with self.assertRaises(FileNotFoundError):
         read_redshift_config_file(file_path)