Coverage for tests/test_app/management/commands/callback1.py: 100%
14 statements
« prev ^ index » next coverage.py v7.3.4, created at 2024-01-20 18:02 +0000
« prev ^ index » next coverage.py v7.3.4, created at 2024-01-20 18:02 +0000
1import json
2from typing import List
4from django_typer import TyperCommand, initialize
7class Command(TyperCommand):
8 help = "Test basic callback command."
10 parameters = {}
12 @initialize()
13 def init(self, p1: int, flag1: bool = False, flag2: bool = True):
14 """
15 The callback to initialize the command.
16 """
17 assert self.__class__ == Command
18 self.parameters = {"p1": p1, "flag1": flag1, "flag2": flag2}
20 def handle(self, arg1: str, arg2: str, arg3: float = 0.5, arg4: int = 1):
21 assert self.__class__ == Command
22 self.parameters.update({"arg1": arg1, "arg2": arg2, "arg3": arg3, "arg4": arg4})
23 return json.dumps(self.parameters)