models.py
Код: Выделить всё
class Proxmox(Model):
@property
def api(self, ...):
....
Код: Выделить всё
def run_task(...):
....
Код: Выделить всё
from models import Proxmox
from tasks import run_task
class APIView(...):
def get(request):
Proxmox.objects.get(...).api.do_something()
run_task()
Код: Выделить всё
class MyTestCase(...):
@mock.patch('tasks.run_task')
Подробнее здесь: [url]https://stackoverflow.com/questions/78411879/why-mock-patch-works-on-attribute-of-object-that-is-already-imported[/url]