def test_failForWrongCntId(self): cnt = CntBasic(get_dummy_basic_cnt(cnt_id=999), offset_in_pck=0) with self.assertRaises(NPKError) as _exception: _ = cnt.cnt_id self.assertEqual( "Cnt object does not represent given container typ -1/999", _exception.exception.args[0])
def test_getFullCntInfo_asString(self): result = get_full_cnt_info( CntBasic(get_dummy_basic_cnt(), offset_in_pck=0)) self.assertEqual([ 'CntBasic', ' Cnt id: -1', ' Cnt offset: 0', ' Cnt len: 13', ' Payload len: 7', " Payload[0:7]: b'Payload' [...] " ], result)
def setUp(self) -> None: self.cnt = CntSquashFsImage(get_dummy_basic_cnt(cnt_id=21), offset_in_pck=0) self.expectedHash = b'\xc3\x04\x15\xea\xccjYDit\xb7\x16\xef\xf5l\xf2\x82\x19\x81]'
def setUp(self) -> None: self.cnt = PktMulticontainerList(get_dummy_basic_cnt(cnt_id=20), offset_in_pck=0)
def test_validateAssignment_DictIdIsContainerId(self): for cnt_id, cnt_class in CNT_HANDLER.items(): if cnt_class != "?": cnt = cnt_class(get_dummy_basic_cnt(), 0) self.assertEqual(cnt_id, cnt._regular_cnt_id, msg=f"{cnt_id}!={cnt._regular_cnt_id}")
def setUp(self) -> None: self.cnt = CntZlibDompressedData(get_dummy_basic_cnt(cnt_id=4), offset_in_pck=0)
def setUp(self) -> None: self.cnt = CntBasic(data=get_dummy_basic_cnt(), offset_in_pck=0)
def test_getFullBinaryOfContainer(self): self.assertEqual(get_dummy_basic_cnt(), self.cnt.cnt_full_binary)
def setUp(self) -> None: self.cnt = PckDescription(get_dummy_basic_cnt(cnt_id=2), offset_in_pck=0)
def setUp(self) -> None: self.cnt = PckPreHeader(get_dummy_basic_cnt(cnt_id=25), offset_in_pck=0)
def setUp(self) -> None: self.cnt = CntSquashFsHashSignature(get_dummy_basic_cnt(cnt_id=9), offset_in_pck=0)
def setUp(self) -> None: self.cnt = CntNullBlock(get_dummy_basic_cnt(cnt_id=22), offset_in_pck=0)
def setUp(self) -> None: self.cnt = CntMpls(get_dummy_basic_cnt(cnt_id=19), offset_in_pck=0)
def setUp(self) -> None: self.cnt = CntFlagA(get_dummy_basic_cnt(cnt_id=7), offset_in_pck=0)
def test_extractCntFromGivenOffset(self): self.assertEqual(len(get_dummy_basic_cnt()), self.cnt.cnt_full_length)
def setUp(self) -> None: self.cnt = PckEckcdsaHash(get_dummy_basic_cnt(cnt_id=23), offset_in_pck=0)
def setUp(self) -> None: self.cnt = PckReleaseTyp(get_dummy_basic_cnt(cnt_id=24), offset_in_pck=0)