【发布时间】:2015-04-04 22:18:02
【问题描述】:
我在 SomeClass 类中编写了一些测试用例,它的工作非常好,对于这个测试用例,我使用了 2 种方法 anyMethod 和 anotherMethod
from tastypie.test import ResourceTestCase from members.models import Org class SomeClass(ResourceTestCase): fixtures = ['anyfixture'] def setUp(self): super(SomeClass, self).setUp() self.webmaster_username = 'webmaster@gm.com' self.webmaster_password = '123' def anyMethod(): self.api_client.client.login(username=self.webmaster_username, password=self.webmaster_password) def anotherMethod(dataDump): self.anyMethod() self.response = self.api_client.post(self.get_detail_url, format='json', data=dataDump) #More steps in function
我想要的是,我有另一个名为 AnotherClass 的类,我想从 SomeClass 调用方法 anotherMethod
from tastypie.test import ResourceTestCase
from members.models import Org
class AnotherClass(ResourceTestCase):
fixtures = ['fixture23']
def setUp(self):
super(AnotherClass, self).setUp()
self.admin_username = 'admin@gm.com'
self.admin_password = '123'
#here I Need to call method anotherMethod from class SomeClass.
【问题讨论】:
标签: django python-2.7 tastypie