Is it possible to use devices from other applications in django tests?

I have 2 applications, members and resources. resources depend on participants. Is it possible to use test devices from a member application in my tests for a resource application?

+7
source share
2 answers

For example, if you have two applications, one of which is called "App1" and the other is called "App2", and the structure of your project is something like this:

myproject/ ----APP1/ --------models/ ------------app_1_model.py --------tests/ ------------test_app1.py --------fixtures/ ------------fixture_app1_number_1.json ------------fixture_app1_number_2.json ----APP2/ --------models/ ------------app_2_model.py --------tests/ ------------test_app2.py --------fixtures/ ------------fixture_app2_number_1.json ------------fixture_app2_number_2.json ------------fixture_app2_number_3.json 

This is an imaginary script, and you want to write a test script for "APP2", but your test script may need data from "APP1", in other words, you need lights in "APP1"

 from APP1.models.app_1_model import * class TestApp2(TestCase): fixtures = ['fixture_app2_number_1','fixture_app2_number_2','fixture_app2_number_3','fixture_app1_number_1'] def test_function_one(self): pass 

as you saw, just write the name of the device APP1 in the list of devices, very smart and simple.

+2
source

Apparently, yes, any device can be downloaded from any application, as if it were in one application, so be careful what you call your lights.: /

+1
source

All Articles