Beispiel #1
0
    def _run_dbshell(self):
        """Run runshell command and capture its arguments."""
        def _mock_subprocess_run(*args, **kwargs):
            self.subprocess_args = list(*args)
            return CompletedProcess(self.subprocess_args, 0)

        client = DatabaseClient(connection)
        with mock.patch('subprocess.run', new=_mock_subprocess_run):
            client.runshell()
        return self.subprocess_args
Beispiel #2
0
 def test_exec(self):
     client = DatabaseClient(connection)
     run_result = client.runshell(input=b'.databases\n', stdout=PIPE, stderr=PIPE)
     self.assertTrue(run_result.stdout)
     self.assertFalse(run_result.stderr)