Coverage for django_napse/core/models/bots/managers/controller.py: 78%

9 statements  

« prev     ^ index     » next       coverage.py v7.4.3, created at 2024-03-12 13:49 +0000

1from django.db import models 

2 

3from django_napse.utils.errors import ControllerError 

4 

5 

6class ControllerManager(models.Manager): 

7 def create(self, **kwargs): 

8 bypass = kwargs.pop("bypass", False) 

9 if not bypass: 

10 error_msg = "Controller.object.create() is not recommended. Use Controller.get() instead." 

11 raise ControllerError.BypassError(error_msg) 

12 return super().create(**kwargs)