Skip to content

Commit

Permalink
fix: Fix command line tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajat Venkatesh authored and vrajat committed Jan 14, 2020
1 parent 633fefc commit dbe756e
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions tests/test_command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_host_required(self):
'Usage: cli db [OPTIONS]\nTry "cli db --help" for help.\n\nError: Missing option "-s" / "--host".\n'
, result.stdout)

@patch('piicatcher.explorer.databases.Explorer')
@patch('piicatcher.explorer.databases.RelDbExplorer')
def test_host(self, explorer):
runner = CliRunner()
result = runner.invoke(cli, ["db", "-s", "connection_string"])
Expand All @@ -33,7 +33,7 @@ def test_host(self, explorer):
orm={'host': None, 'port': None,
'user': None, 'password': None}))

@patch('piicatcher.explorer.databases.Explorer')
@patch('piicatcher.explorer.databases.RelDbExplorer')
def test_port(self, explorer):
runner = CliRunner()
result = runner.invoke(cli, ["db", "-s", "connection_string", "-R", "6032"])
Expand All @@ -52,7 +52,7 @@ def test_port(self, explorer):
orm={'host': None, 'port': None,
'user': None, 'password': None}))

@patch('piicatcher.explorer.databases.Explorer')
@patch('piicatcher.explorer.databases.RelDbExplorer')
def test_host_user_password(self, explorer):
runner = CliRunner()
result = runner.invoke(cli, ["db", "-s", "connection_string", "-u", "user", "-p", "passwd"])
Expand All @@ -71,7 +71,7 @@ def test_host_user_password(self, explorer):
orm={'host': None, 'port': None,
'user': None, 'password': None}))

@patch('piicatcher.explorer.databases.Explorer')
@patch('piicatcher.explorer.databases.RelDbExplorer')
def test_deep_scan_type(self, explorer):
runner = CliRunner()
result = runner.invoke(cli, ["db", "-s", "connection_string", "-c", "deep"])
Expand All @@ -90,7 +90,7 @@ def test_deep_scan_type(self, explorer):
orm={'host': None, 'port': None,
'user': None, 'password': None}))

@patch('piicatcher.explorer.databases.Explorer')
@patch('piicatcher.explorer.databases.RelDbExplorer')
def test_deep_scan_type(self, explorer):
runner = CliRunner()
result = runner.invoke(cli, ["db", "-s", "connection_string", "-c", "shallow"])
Expand All @@ -109,14 +109,6 @@ def test_deep_scan_type(self, explorer):
orm={'host': None, 'port': None,
'user': None, 'password': None}))

@patch('piicatcher.explorer.databases.Explorer')
def test_successful_dispatch(self, explorer):
runner = CliRunner()
result = runner.invoke(cli, ["db", "-s", "connection_string", "-c", "shallow"])
self.assertEqual("", result.stdout)
self.assertEqual(0, result.exit_code)
explorer.shallow_scan.assert_called_once()


class TestSqliteParser(TestCase):
def test_path_required(self):
Expand All @@ -127,7 +119,7 @@ def test_path_required(self):
'Usage: cli sqlite [OPTIONS]\nTry "cli sqlite --help" for help.\n\nError: Missing option "-s" / "--path".\n'
, result.stdout)

@patch('piicatcher.explorer.sqlite.Explorer')
@patch('piicatcher.explorer.sqlite.SqliteExplorer')
def test_host(self, explorer):
runner = CliRunner()
result = runner.invoke(cli, ["sqlite", "-s", "connection_string"])
Expand All @@ -144,7 +136,7 @@ def test_host(self, explorer):

class TestAWSParser(TestCase):

@patch('piicatcher.explorer.aws.Explorer')
@patch('piicatcher.explorer.aws.AthenaExplorer')
def test_host_user_password(self, explorer):
runner = CliRunner()
result = runner.invoke(cli, ["aws", "-a", "AAAA", "-s", "SSSS", "-d", "s3://dir", "-r", "us-east"])
Expand Down

0 comments on commit dbe756e

Please sign in to comment.