Пример #1
0
 def test_all_specified(self):
     self.assertEqual(
         ReportMessage(
             "a string",
             "another string",
             ["str1", "str0"],
             [0, 1, 0],
             {
                 "str1": 1,
                 "key": "val",
                 "another": False
             },
         ).to_dto(),
         dto.ReportItemMessageDto(
             REPORT_CODE,
             "a message",
             dict(
                 string="a string",
                 union_str_or_list_of_str="another string",
                 list_of_str=["str1", "str0"],
                 optional_list_of_int=[0, 1, 0],
                 optional_mapping_str_to_any=dict(
                     str1=1,
                     key="val",
                     another=False,
                 ),
             ),
         ),
     )
Пример #2
0
 def test_with_inner_msg(self):
     self.assertEqual(
         OuterReportMessage(ReportMessage("a string", ["str1", "str0"]),
                            "a str").to_dto(),
         dto.ReportItemMessageDto(
             OUTER_REPORT_CODE,
             "an outer message",
             dict(
                 optional_inner_msg=dto.ReportItemMessageDto(
                     REPORT_CODE,
                     "a message",
                     dict(
                         string="a string",
                         union_str_or_list_of_str=["str1", "str0"],
                         list_of_str=[],
                         optional_list_of_int=None,
                         optional_mapping_str_to_any=None,
                     ),
                 ),
                 optional_string="a str",
             ),
         ),
     )
Пример #3
0
 def test_minimal(self):
     self.assertEqual(
         ReportMessage("a string", ["str1", "str0"]).to_dto(),
         dto.ReportItemMessageDto(
             REPORT_CODE,
             "a message",
             dict(
                 string="a string",
                 union_str_or_list_of_str=["str1", "str0"],
                 list_of_str=[],
                 optional_list_of_int=None,
                 optional_mapping_str_to_any=None,
             ),
         ),
     )