From 1cde31c86d9423e9b7a7409c2ef2ba7c0500e47f Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Sat, 25 Feb 2012 18:45:17 +0000 Subject: Massive merge --- examples/pygments_api/tests.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'examples/pygments_api/tests.py') diff --git a/examples/pygments_api/tests.py b/examples/pygments_api/tests.py index 24726647..b728c3c2 100644 --- a/examples/pygments_api/tests.py +++ b/examples/pygments_api/tests.py @@ -14,13 +14,13 @@ class TestPygmentsExample(TestCase): self.factory = RequestFactory() self.temp_dir = tempfile.mkdtemp() views.HIGHLIGHTED_CODE_DIR = self.temp_dir - + def tearDown(self): try: shutil.rmtree(self.temp_dir) except Exception: pass - + def test_get_to_root(self): '''Just do a get on the base url''' request = self.factory.get('/pygments') @@ -44,6 +44,3 @@ class TestPygmentsExample(TestCase): response = view(request) response_locations = json.loads(response.content) self.assertEquals(locations, response_locations) - - - -- cgit v1.2.3 From eea2aa04378d27d79e7aba12ce95c697148bd57e Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Wed, 29 Aug 2012 19:54:38 +0100 Subject: Remove examples (to be moved to a seperate project) --- examples/pygments_api/tests.py | 46 ------------------------------------------ 1 file changed, 46 deletions(-) delete mode 100644 examples/pygments_api/tests.py (limited to 'examples/pygments_api/tests.py') diff --git a/examples/pygments_api/tests.py b/examples/pygments_api/tests.py deleted file mode 100644 index b728c3c2..00000000 --- a/examples/pygments_api/tests.py +++ /dev/null @@ -1,46 +0,0 @@ -from django.test import TestCase -from django.utils import simplejson as json - -from djangorestframework.compat import RequestFactory - -from pygments_api import views -import tempfile, shutil - - - -class TestPygmentsExample(TestCase): - - def setUp(self): - self.factory = RequestFactory() - self.temp_dir = tempfile.mkdtemp() - views.HIGHLIGHTED_CODE_DIR = self.temp_dir - - def tearDown(self): - try: - shutil.rmtree(self.temp_dir) - except Exception: - pass - - def test_get_to_root(self): - '''Just do a get on the base url''' - request = self.factory.get('/pygments') - view = views.PygmentsRoot.as_view() - response = view(request) - self.assertEqual(response.status_code, 200) - - def test_snippets_datetime_sorted(self): - '''Pygments examples should be datetime sorted''' - locations = [] - for snippet in 'abcdefghij': # String length must not exceed views.MAX_FILES, otherwise test fails - form_data = {'code': '%s' % snippet, 'style':'friendly', 'lexer':'python'} - request = self.factory.post('/pygments', data=form_data) - view = views.PygmentsRoot.as_view() - response = view(request) - locations.append(response.items()[2][1]) - import time - time.sleep(.1) - request = self.factory.get('/pygments') - view = views.PygmentsRoot.as_view() - response = view(request) - response_locations = json.loads(response.content) - self.assertEquals(locations, response_locations) -- cgit v1.2.3