forked from guardian/athena-cli
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_cli.py
41 lines (28 loc) · 1 KB
/
test_cli.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import unittest
from cmd2.parsing import StatementParser
from athena_cli import Athena, AthenaShell
class TestCLI(unittest.TestCase):
def setUp(self):
pass
def test_use_schema(self):
athena = Athena(profile=None, region='eu-west-1', bucket='s3://', debug=False)
shell = AthenaShell(athena, db='sampledb')
self.assertEqual(shell.dbname, 'sampledb')
shell.do_use('clean')
self.assertEqual(shell.dbname, 'clean')
def test_parser(self):
parser = StatementParser()
line = """
SELECT *
FROM elb_logs
"""
statement = parser.parse(line)
self.assertEqual(statement.command, 'SELECT')
self.assertEqual(statement.command_and_args, 'SELECT * FROM elb_logs')
line = """
select *
from elb_logs
"""
statement = parser.parse(line)
self.assertEqual(statement.command, 'select')
self.assertEqual(statement.command_and_args, 'select * from elb_logs')