Skip to content

Commit

Permalink
Use http_url property from testcontainers fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
pilosus committed Nov 24, 2023
1 parent a739b1c commit 7e20b38
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def _output_format(self, format, func, query="select name from sys.cluster"):
try:
sys.argv = ["testcrash",
"-c", query,
"--hosts", node.get_http_url(),
"--hosts", node.http_url,
'--format', format
]
with patch('sys.stdout', new_callable=StringIO) as output:
Expand Down Expand Up @@ -223,7 +223,7 @@ def test_stdin_cmd(self):
orig_argv = sys.argv[:]
tmphistory = tempfile.mkstemp()[1]
sys.argv = ['testcrash',
'--hosts', node.get_http_url(),
'--hosts', node.http_url,
'--history', tmphistory]
with patch('sys.stdout', new_callable=StringIO) as output:
try:
Expand Down Expand Up @@ -253,7 +253,7 @@ def test_cmd_precedence(self):
tmphistory = tempfile.mkstemp()[1]
sys.argv = ['testcrash',
"--command", stmt,
'--hosts', node.get_http_url(),
'--hosts', node.http_url,
'--history', tmphistory]
with patch('sys.stdout', new_callable=StringIO) as output:
try:
Expand All @@ -278,7 +278,7 @@ def test_multiple_hosts(self):
tmphistory = tempfile.mkstemp()[1]
sys.argv = ["testcrash",
"-c", "select * from sys.cluster",
"--hosts", node.get_http_url(), "127.0.0.1:1",
"--hosts", node.http_url, "127.0.0.1:1",
'--history', tmphistory,
'--format', 'tabular',
'-v',
Expand All @@ -302,7 +302,7 @@ def test_multiple_hosts(self):

def test_cmd_line_sys_info(self):
sys.argv = ["testcrash",
"--hosts", node.get_http_url(),
"--hosts", node.http_url,
"--sysinfo"
]
with patch('sys.stdout', new_callable=StringIO):
Expand Down Expand Up @@ -550,7 +550,7 @@ def test_error_exit_code(self):
sys.argv = [
"testcrash",
"--command", stmt,
'--hosts', node.get_http_url()
'--hosts', node.http_url
]
try:
main()
Expand Down Expand Up @@ -676,7 +676,7 @@ def test_wrong_host_format(self):
_create_shell(crate_hosts, False, None, False, args)

def test_command_timeout(self):
with CrateShell(node.get_http_url()) as crash:
with CrateShell(node.http_url) as crash:
crash.process("""
CREATE FUNCTION fib(long)
RETURNS LONG
Expand All @@ -691,15 +691,15 @@ def test_command_timeout(self):
slow_query = "SELECT fib(35)"

# without verbose
with CrateShell(node.get_http_url(),
with CrateShell(node.http_url,
error_trace=False,
timeout=timeout) as crash:
crash.logger = Mock()
crash.process(slow_query)
crash.logger.warn.assert_any_call("Use \\connect <server> to connect to one or more servers first.")

# with verbose
with CrateShell(node.get_http_url(),
with CrateShell(node.http_url,
error_trace=True,
timeout=timeout) as crash:
crash.logger = Mock()
Expand All @@ -715,7 +715,7 @@ def test_command_timeout(self):
crash.logger.warn.assert_any_call("Use \\connect <server> to connect to one or more servers first.")

def test_username_param(self):
with CrateShell(node.get_http_url(),
with CrateShell(node.http_url,
username='crate') as crash:
self.assertEqual(crash.username, "crate")
self.assertEqual(crash.connection.client.username, "crate")
Expand All @@ -730,7 +730,7 @@ def test_ssl_params(self):
ftouch(key_filename)
ftouch(ca_cert_filename)

with CrateShell(node.get_http_url(),
with CrateShell(node.http_url,
verify_ssl=False,
cert_file=cert_filename,
key_file=key_filename,
Expand All @@ -749,7 +749,7 @@ def test_ssl_params(self):

def test_ssl_params_missing_file(self):
argv = [
"--hosts", node.get_http_url(),
"--hosts", node.http_url,
"--verify-ssl", "false",
"--key-file", "wrong_file",
"--ca-cert-file", "ca_cert_file"
Expand All @@ -765,7 +765,7 @@ def test_ssl_params_wrong_permision_file(self):
os.chmod(ca_cert_filename, 0000)

argv = [
"--hosts", node.get_http_url(),
"--hosts", node.http_url,
"--verify-ssl", "false",
"--ca-cert-file", ca_cert_filename
]
Expand All @@ -774,7 +774,7 @@ def test_ssl_params_wrong_permision_file(self):
parser.parse_args(argv)

def test_close_shell(self):
crash = CrateShell(node.get_http_url())
crash = CrateShell(node.http_url)
self.assertFalse(crash.is_closed())
self.assertTrue(crash.is_conn_available())

Expand All @@ -789,7 +789,7 @@ def test_close_shell(self):
ctx.exception.message)

def test_connect_info(self):
with CrateShell(node.get_http_url(),
with CrateShell(node.http_url,
username='crate',
schema='test') as crash:
self.assertEqual(crash.connect_info.user, "crate")
Expand Down Expand Up @@ -838,7 +838,7 @@ def test_connect_info(self):
@patch.object(CrateShell, "is_conn_available")
def test_connect_info_not_available(self, is_conn_available):
is_conn_available.return_value = False
with CrateShell(node.get_http_url(),
with CrateShell(node.http_url,
username='crate',
schema='test') as crash:
self.assertEqual(crash.connect_info.user, None)
Expand Down

0 comments on commit 7e20b38

Please sign in to comment.