Пример #1
0
    def test_sqlite_command(self):
        """Test SQLite"""

        options = {
            "path": os.path.abspath(ASSETS_DIR / "input.sqlite3"),
            "query": "SELECT id FROM One;",
        }
        argv = [get_name(), self.command, options["path"], options["query"]]
        self.assertEqual(execute_from_command_line(argv), None)
Пример #2
0
    def test_excel_command(self):
        """Test Excel"""

        options = {
            "path": os.path.abspath(ASSETS_DIR / "input.xlsx"),
            "sheet": "Sheet1",
        }
        argv = [
            get_name(), self.command, options["path"], "-S", options["sheet"]
        ]
        self.assertEqual(execute_from_command_line(argv), None)
Пример #3
0
    def test_neo4j_command(self):
        """Test Neo4j"""

        options = {
            "user": "******",
            "password": "******",
            "query": "MATCH 1 AS One;",
        }
        argv = [
            get_name(),
            "neo4j",
            options["user"],
            options["password"],
            options["query"],
        ]
        self.assertEqual(execute_from_command_line(argv), None)
Пример #4
0
    def test_unknown_args(self):
        """Test Unknown Command Error"""

        argv = [get_name(), self.command, "path", "-l", "82"]
        with self.assertRaises(SystemExit):
            execute_from_command_line(argv)
Пример #5
0
    def test_possible_match(self):
        """Test Command Error"""

        argv = [get_name(), "xsv"]
        with self.assertRaises(SystemExit):
            execute_from_command_line(argv)
Пример #6
0
    def test_commands_flag(self):
        """Test Commands Flag"""

        argv = [get_name(), "help", "--commands"]
        self.assertEqual(execute_from_command_line(argv), None)
Пример #7
0
    def test_version(self):
        """Test Version"""

        argv = [get_name(), "--version"]
        self.assertEqual(execute_from_command_line(argv), None)
Пример #8
0
    def test_unknown_command(self):
        """Test Unknown Command"""

        argv = [get_name(), "unknown"]
        with self.assertRaises(SystemExit):
            execute_from_command_line(argv)
Пример #9
0
    def test_empty_base_command(self):
        """Test Empty Base Command"""

        argv = [get_name()]
        self.assertEqual(execute_from_command_line(argv), None)
Пример #10
0
from table2json.bin import execute_from_command_line

if __name__ == "__main__":
    """Run"""

    execute_from_command_line()
Пример #11
0
    def test_csv_command(self):
        """Test CSV"""

        options = {"path": os.path.abspath(ASSETS_DIR / "input.csv")}
        argv = [get_name(), self.command, options["path"]]
        self.assertEqual(execute_from_command_line(argv), None)