forked from piccolo-orm/piccolo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_run.py
More file actions
31 lines (26 loc) · 939 Bytes
/
test_run.py
File metadata and controls
31 lines (26 loc) · 939 Bytes
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
from unittest import TestCase
from unittest.mock import call, patch, MagicMock
from piccolo.apps.shell.commands.run import run
class TestRun(TestCase):
@patch("piccolo.apps.shell.commands.run.start_ipython_shell")
@patch("piccolo.apps.shell.commands.run.print")
def test_run(self, print_: MagicMock, start_ipython_shell: MagicMock):
"""
A simple test to make sure it executes without raising any exceptions.
"""
run()
self.assertEqual(
print_.mock_calls,
[
call("-------"),
call("Importing example_app tables:"),
call("- Band"),
call("- Concert"),
call("- Manager"),
call("- Poster"),
call("- Ticket"),
call("- Venue"),
call("-------"),
],
)
self.assertTrue(start_ipython_shell.called)