summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/toaster/tests/db/__init__.py0
-rw-r--r--bitbake/lib/toaster/tests/db/test_db.py55
2 files changed, 55 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/tests/db/__init__.py b/bitbake/lib/toaster/tests/db/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/bitbake/lib/toaster/tests/db/__init__.py
diff --git a/bitbake/lib/toaster/tests/db/test_db.py b/bitbake/lib/toaster/tests/db/test_db.py
new file mode 100644
index 0000000000..a0f5f6ec03
--- /dev/null
+++ b/bitbake/lib/toaster/tests/db/test_db.py
@@ -0,0 +1,55 @@
1# The MIT License (MIT)
2#
3# Copyright (c) 2016 Damien Lespiau
4#
5# Permission is hereby granted, free of charge, to any person obtaining a copy
6# of this software and associated documentation files (the "Software"), to deal
7# in the Software without restriction, including without limitation the rights
8# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9# copies of the Software, and to permit persons to whom the Software is
10# furnished to do so, subject to the following conditions:
11#
12# The above copyright notice and this permission notice shall be included in
13# all copies or substantial portions of the Software.
14#
15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21# SOFTWARE.
22
23import sys
24
25try:
26 from StringIO import StringIO
27except ImportError:
28 from io import StringIO
29
30from contextlib import contextmanager
31
32from django.core import management
33from django.test import TestCase
34
35
36@contextmanager
37def capture(command, *args, **kwargs):
38 out, sys.stdout = sys.stdout, StringIO()
39 command(*args, **kwargs)
40 sys.stdout.seek(0)
41 yield sys.stdout.read()
42 sys.stdout = out
43
44
45def makemigrations():
46 management.call_command('makemigrations')
47
48
49class MigrationTest(TestCase):
50
51 def testPendingMigration(self):
52 """Make sure there's no pending migration."""
53
54 with capture(makemigrations) as output:
55 self.assertEqual(output, "No changes detected\n")