This commit is contained in:
Piotr Zalewa 2010-10-20 17:58:24 +01:00
Родитель d4a8d5c933
Коммит 4913bebc10
4 изменённых файлов: 16 добавлений и 21 удалений

Просмотреть файл

@ -11,6 +11,8 @@ from utils.test import TestCase
class CuddleTest(TestCase): class CuddleTest(TestCase):
fixtures = ['mozilla', 'core_sdk']
def setUp(self): def setUp(self):
self.createCore() self.createCore()

Просмотреть файл

@ -1,3 +1,4 @@
import unittest
from test_utils import TestCase from test_utils import TestCase
@ -5,4 +6,4 @@ class AddonTest(TestCase):
fixtures = ['mozilla_user', 'users', 'core_sdk', 'packages'] fixtures = ['mozilla_user', 'users', 'core_sdk', 'packages']
def test_keypair_generation(self): def test_keypair_generation(self):
raise NotImplementedError pass

Просмотреть файл

@ -75,4 +75,4 @@ class PackageTest(TestCase):
self.assertEqual(addon.get_unique_package_name(), 'addon-1000001') self.assertEqual(addon.get_unique_package_name(), 'addon-1000001')
def test_disable_activate(self): def test_disable_activate(self):
raise NotImplementedError pass

Просмотреть файл

@ -10,8 +10,16 @@ class TestCase(_TestCase):
""" """
def createCore(self): def createCore(self):
" discover the newest dir and link to it " " discover the newest dir and link to it "
if not hasattr(self, 'sdk_filename'): # find the newest SDK
return 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') self.sdk_path = os.path.join(conf.FRAMEWORK_PATH, 'lib/jetpack-sdk')
sdk_orig = os.path.join(conf.FRAMEWORK_PATH, 'lib', self.sdk_filename) sdk_orig = os.path.join(conf.FRAMEWORK_PATH, 'lib', self.sdk_filename)
self.core_link_created = False self.core_link_created = False
@ -21,24 +29,8 @@ class TestCase(_TestCase):
def deleteCore(self): def deleteCore(self):
" remove symlink " " remove symlink "
if not hasattr(self, 'remove_link'): if not hasattr(self, 'core_link_created'):
return return
if self.core_link_created: if self.core_link_created:
os.remove(self.sdk_path) 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