fid*_*ego 4 django django-rest-framework
我正在使用django-rest-framework来创建API.我正在使用框架APITestCase来测试我的一些端点.
文档没有指定加载灯具的方法,传统fixtures= ['initial_data.json']似乎没有工作.
怎么会加载装置?
你描述的方式也应该有效.确保您在测试类中声明了灯具.以下示例:
class MyViewsTestCase(APITestCase):
fixtures = ['some_testdata.json']
def test_random_thingy(self):
variable = 'hello'
self.assertEqual(variable, 'hello')
Run Code Online (Sandbox Code Playgroud)
每次运行测试时,都会在测试运行后加载和删除灯具.
| 归档时间: |
|
| 查看次数: |
2267 次 |
| 最近记录: |