Mikhail Korobov avatar Mikhail Korobov committed 72b44f8

Tests for customdashboard management command

Comments (0)

Files changed (4)

 Running tests
 =============
-::
 
-    $ cd test_proj
-    $ ./test.sh
+Run 'runtests.sh' script.
 
 
 Code coverage report

admin_tools/dashboard/tests.py

-"""
-This file demonstrates two different styles of tests (one doctest and one
-unittest). These will both pass when you run "manage.py test".
+from tempfile import mkstemp, mktemp
+from django.test import TestCase
+from django.core import management
 
-Replace these with more appropriate tests for your application.
-"""
+class ManagementCommandTest(TestCase):
+    def test_customdashboard(self):
+        # check that customdashboard command don't raise exceptions
+        file_name = mktemp()
+        management.call_command('customdashboard', file=file_name)
+        # and fails if file is already here
+        try:
+            management.call_command('customdashboard', file=file_name)
+            assert False
+        except:
+            pass
 
-from django.test import TestCase
-
-class SimpleTest(TestCase):
-    def test_basic_addition(self):
-        """
-        Tests that 1 + 1 always equals 2.
-        """
-        self.failUnlessEqual(1 + 1, 2)
-
-__test__ = {"doctest": """
-Another way to test that 1 + 1 is equal to 2.
-
->>> 1 + 1 == 2
-True
-"""}
-
+#!/bin/sh
+default_tests='dashboard theming menu test_app'
+if [ $# -eq 0 ]
+then
+    test_proj/manage.py test $default_tests
+else
+    test_proj/manage.py test $*
+fi

test_proj/test.sh

-#!/bin/sh
-
-default_tests='dashboard theming menu test_app'
-if [ $# -eq 0 ]
-then
-    ./manage.py test $default_tests
-else
-    ./manage.py test $*
-fi
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.