def test_parameters_to_uri_sqlite(self): view = MockView(combos={"name_combo": [], "type_combo": []}) prefs.prefs[bauble.conn_default_pref] = None prefs.prefs[bauble.conn_list_pref] = {} presenter = ConnMgrPresenter(view) params = {"type": "SQLite", "default": False, "file": "/tmp/test.db", "pictures": "/tmp/"} self.assertEquals(presenter.parameters_to_uri(params), "sqlite:////tmp/test.db") params = { "type": "PostgreSQL", "passwd": False, "pictures": "/tmp/", "db": "quisquis", "host": "localhost", "user": "******", } self.assertEquals(presenter.parameters_to_uri(params), "postgresql://pg@localhost/quisquis") params = { "type": "PostgreSQL", "passwd": True, "pictures": "/tmp/", "db": "quisquis", "host": "localhost", "user": "******", } view.reply_entry_dialog.append("secret") self.assertEquals(presenter.parameters_to_uri(params), "postgresql://*****:*****@localhost/quisquis") params = { "type": "PostgreSQL", "passwd": False, "pictures": "/tmp/", "port": "9876", "db": "quisquis", "host": "localhost", "user": "******", } self.assertEquals(presenter.parameters_to_uri(params), "postgresql://pg@localhost:9876/quisquis") params = { "type": "PostgreSQL", "passwd": True, "pictures": "/tmp/", "port": "9876", "db": "quisquis", "host": "localhost", "user": "******", } view.reply_entry_dialog.append("secret") self.assertEquals(presenter.parameters_to_uri(params), "postgresql://*****:*****@localhost:9876/quisquis") params = { "type": "PostgreSQL", "passwd": False, "pictures": "/tmp/", "options": ["is_this_possible=no", "why_do_we_test=because"], "db": "quisquis", "host": "localhost", "user": "******", } self.assertEquals( presenter.parameters_to_uri(params), "postgresql://pg@localhost/quisquis?" "is_this_possible=no&why_do_we_test=because", )
def test_parameters_to_uri_sqlite(self): view = MockView(combos={'name_combo': [], 'type_combo': []}) prefs.prefs[bauble.conn_default_pref] = None prefs.prefs[bauble.conn_list_pref] = {} presenter = ConnMgrPresenter(view) params = {'type': 'SQLite', 'default': False, 'file': '/tmp/test.db', 'pictures': '/tmp/'} self.assertEquals(presenter.parameters_to_uri(params), 'sqlite:////tmp/test.db') params = {'type': 'PostgreSQL', 'passwd': False, 'pictures': '/tmp/', 'db': 'quisquis', 'host': 'localhost', 'user': '******'} self.assertEquals(presenter.parameters_to_uri(params), 'postgresql://pg@localhost/quisquis') params = {'type': 'PostgreSQL', 'passwd': True, 'pictures': '/tmp/', 'db': 'quisquis', 'host': 'localhost', 'user': '******'} view.reply_entry_dialog.append('secret') self.assertEquals(presenter.parameters_to_uri(params), 'postgresql://*****:*****@localhost/quisquis') params = {'type': 'PostgreSQL', 'passwd': False, 'pictures': '/tmp/', 'port': '9876', 'db': 'quisquis', 'host': 'localhost', 'user': '******'} self.assertEquals(presenter.parameters_to_uri(params), 'postgresql://pg@localhost:9876/quisquis') params = {'type': 'PostgreSQL', 'passwd': True, 'pictures': '/tmp/', 'port': '9876', 'db': 'quisquis', 'host': 'localhost', 'user': '******'} view.reply_entry_dialog.append('secret') self.assertEquals(presenter.parameters_to_uri(params), 'postgresql://*****:*****@localhost:9876/quisquis') params = {'type': 'PostgreSQL', 'passwd': False, 'pictures': '/tmp/', 'options': ['is_this_possible=no', 'why_do_we_test=because'], 'db': 'quisquis', 'host': 'localhost', 'user': '******'} self.assertEquals(presenter.parameters_to_uri(params), 'postgresql://pg@localhost/quisquis?' 'is_this_possible=no&why_do_we_test=because')
def test_parameters_to_uri_sqlite(self): view = MockView(combos={'name_combo': [], 'type_combo': []}) prefs.prefs[bauble.conn_default_pref] = None prefs.prefs[bauble.conn_list_pref] = {} presenter = ConnMgrPresenter(view) params = {'type': 'SQLite', 'default': False, 'file': '/tmp/test.db', 'pictures': '/tmp/'} self.assertEquals(presenter.parameters_to_uri(params), 'sqlite:////tmp/test.db') params = {'type': 'PostgreSQL', 'passwd': False, 'pictures': '/tmp/', 'db': 'quisquis', 'host': 'localhost', 'user': '******'} self.assertEquals(presenter.parameters_to_uri(params), 'postgresql://pg@localhost/quisquis') params = {'type': 'PostgreSQL', 'passwd': True, 'pictures': '/tmp/', 'db': 'quisquis', 'host': 'localhost', 'user': '******'} view.reply_entry_dialog.append('secret') self.assertEquals(presenter.parameters_to_uri(params), 'postgresql://*****:*****@localhost/quisquis') params = {'type': 'PostgreSQL', 'passwd': False, 'pictures': '/tmp/', 'port': '9876', 'db': 'quisquis', 'host': 'localhost', 'user': '******'} self.assertEquals(presenter.parameters_to_uri(params), 'postgresql://pg@localhost:9876/quisquis') params = {'type': 'PostgreSQL', 'passwd': True, 'pictures': '/tmp/', 'port': '9876', 'db': 'quisquis', 'host': 'localhost', 'user': '******'} view.reply_entry_dialog.append('secret') self.assertEquals(presenter.parameters_to_uri(params), 'postgresql://*****:*****@localhost:9876/quisquis') params = {'type': 'PostgreSQL', 'passwd': False, 'pictures': '/tmp/', 'options': ['is_this_possible=no', 'why_do_we_test=because'], 'db': 'quisquis', 'host': 'localhost', 'user': '******'} self.assertEquals(presenter.parameters_to_uri(params), 'postgresql://pg@localhost/quisquis?' 'is_this_possible=no&why_do_we_test=because')