Coverage for django_napse/core/models/connections/managers/connection.py: 100%

9 statements  

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

1from django.apps import apps 

2from django.db import models 

3 

4 

5class ConnectionManager(models.Manager): 

6 """Define how the Connection.objects works.""" 

7 

8 def create(self, owner: "Wallet", bot: "Bot") -> "Connection": # noqa: F821 

9 ConnectionWallet = apps.get_model("django_napse_core", "ConnectionWallet") 

10 

11 connection = self.model(owner=owner, bot=bot) 

12 connection.save() 

13 # bot.init_specific_args(connection) # noqa: ERA001 

14 ConnectionWallet.objects.create( 

15 title=f"Connection between {owner.title} - {bot.name}", 

16 owner=connection, 

17 ) 

18 return connection