MCPcopy Create free account
hub / github.com/dbcli/mssql-cli / RowLimitTests

Class RowLimitTests

tests/test_rowlimit.py:8–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6from mssqltestutils import create_mssql_cli_options
7
8class RowLimitTests(unittest.TestCase):
9
10 DEFAULT_OPTIONS = create_mssql_cli_options()
11 DEFAULT = MssqlCli(DEFAULT_OPTIONS).row_limit
12 LIMIT = DEFAULT + 1000
13
14 low_count = 1
15 over_default = DEFAULT + 1
16 over_limit = LIMIT + 1
17
18 def test_default_row_limit(self):
19 cli = MssqlCli(self.DEFAULT_OPTIONS)
20 stmt = "SELECT * FROM students"
21 result = cli._should_show_limit_prompt(stmt, ['row']*self.low_count)
22 assert not result
23
24 result = cli._should_show_limit_prompt(stmt, ['row']*self.over_default)
25 assert result
26
27 def test_no_limit(self):
28 cli_options = create_mssql_cli_options(row_limit=0)
29 cli = MssqlCli(cli_options)
30 assert cli.row_limit == 0
31 stmt = "SELECT * FROM students"
32
33 result = cli._should_show_limit_prompt(stmt, ['row']*self.over_limit)
34 assert not result
35
36 def test_row_limit_on_non_select(self):
37 cli = MssqlCli(self.DEFAULT_OPTIONS)
38 stmt = "UPDATE students set name='Boby'"
39 result = cli._should_show_limit_prompt(stmt, None)
40 assert not result
41
42 cli_options = create_mssql_cli_options(row_limit=0)
43 assert cli_options.row_limit == 0
44 cli = MssqlCli(cli_options)
45 result = cli._should_show_limit_prompt(stmt, ['row']*self.over_default)
46 assert cli.row_limit == 0
47 assert not result
48
49
50class TestRowLimitArgs:

Callers

nothing calls this directly

Calls 2

create_mssql_cli_optionsFunction · 0.90
MssqlCliClass · 0.90

Tested by

no test coverage detected