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)
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)
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)
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)
def test_possible_match(self): """Test Command Error""" argv = [get_name(), "xsv"] with self.assertRaises(SystemExit): execute_from_command_line(argv)
def test_commands_flag(self): """Test Commands Flag""" argv = [get_name(), "help", "--commands"] self.assertEqual(execute_from_command_line(argv), None)
def test_version(self): """Test Version""" argv = [get_name(), "--version"] self.assertEqual(execute_from_command_line(argv), None)
def test_unknown_command(self): """Test Unknown Command""" argv = [get_name(), "unknown"] with self.assertRaises(SystemExit): execute_from_command_line(argv)
def test_empty_base_command(self): """Test Empty Base Command""" argv = [get_name()] self.assertEqual(execute_from_command_line(argv), None)
from table2json.bin import execute_from_command_line if __name__ == "__main__": """Run""" execute_from_command_line()
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)