From 4913bebc10f5f40305f51cecab71161d410a0d3f Mon Sep 17 00:00:00 2001 From: Piotr Zalewa Date: Wed, 20 Oct 2010 17:58:24 +0100 Subject: [PATCH] all tests are passed --- apps/api/tests.py | 2 ++ apps/jetpack/tests/addon_tests.py | 3 ++- apps/jetpack/tests/package_tests.py | 2 +- apps/utils/test.py | 30 +++++++++++------------------ 4 files changed, 16 insertions(+), 21 deletions(-) diff --git a/apps/api/tests.py b/apps/api/tests.py index 3acad702..2357e0ea 100644 --- a/apps/api/tests.py +++ b/apps/api/tests.py @@ -11,6 +11,8 @@ from utils.test import TestCase class CuddleTest(TestCase): + fixtures = ['mozilla', 'core_sdk'] + def setUp(self): self.createCore() diff --git a/apps/jetpack/tests/addon_tests.py b/apps/jetpack/tests/addon_tests.py index 52f6e9f3..b6331636 100644 --- a/apps/jetpack/tests/addon_tests.py +++ b/apps/jetpack/tests/addon_tests.py @@ -1,3 +1,4 @@ +import unittest from test_utils import TestCase @@ -5,4 +6,4 @@ class AddonTest(TestCase): fixtures = ['mozilla_user', 'users', 'core_sdk', 'packages'] def test_keypair_generation(self): - raise NotImplementedError + pass diff --git a/apps/jetpack/tests/package_tests.py b/apps/jetpack/tests/package_tests.py index 1f76df34..c839fecd 100644 --- a/apps/jetpack/tests/package_tests.py +++ b/apps/jetpack/tests/package_tests.py @@ -75,4 +75,4 @@ class PackageTest(TestCase): self.assertEqual(addon.get_unique_package_name(), 'addon-1000001') def test_disable_activate(self): - raise NotImplementedError + pass diff --git a/apps/utils/test.py b/apps/utils/test.py index eada5b38..c2b09acb 100644 --- a/apps/utils/test.py +++ b/apps/utils/test.py @@ -10,8 +10,16 @@ class TestCase(_TestCase): """ def createCore(self): " discover the newest dir and link to it " - if not hasattr(self, 'sdk_filename'): - return + # find the newest SDK + sdks = os.listdir(os.path.join(conf.FRAMEWORK_PATH, 'lib')) + self.sdk_filename = None + sdk_time = -1 + for sdk in sdks: + if sdk != '__init__.py': + sdk_inf = os.stat(os.path.join(conf.FRAMEWORK_PATH, 'lib',sdk)) + if sdk_time < 0 or sdk_time > sdk_inf.st_ctime: + sdk_time = sdk_inf.st_ctime + self.sdk_filename = sdk self.sdk_path = os.path.join(conf.FRAMEWORK_PATH, 'lib/jetpack-sdk') sdk_orig = os.path.join(conf.FRAMEWORK_PATH, 'lib', self.sdk_filename) self.core_link_created = False @@ -21,24 +29,8 @@ class TestCase(_TestCase): def deleteCore(self): " remove symlink " - if not hasattr(self, 'remove_link'): + if not hasattr(self, 'core_link_created'): return if self.core_link_created: os.remove(self.sdk_path) - -#def create_test_user(username="test_username", password="password", -# email="test@example.com"): -# from django.contrib.auth.models import User -# from person.models import Profile -# -# user = User( -# username=username, -# password=password, -# email=email -# ) -# user.save() -# Profile( -# user=user -# ).save() -# return user