mirror of
https://github.com/botlabsDev/npkpy.git
synced 2026-01-27 22:57:16 +01:00
27 lines
841 B
Python
27 lines
841 B
Python
import struct
|
|
import unittest
|
|
|
|
from npkpy.npk.cnt_squasfs_image import CntSquashFsImage
|
|
from tests.constants import DummyBasicCnt
|
|
|
|
|
|
class Test_cntSquashFsImage(unittest.TestCase):
|
|
def setUp(self) -> None:
|
|
dummyCnt = DummyBasicCnt()
|
|
dummyCnt._00_cnt_id = struct.pack("h", 21)
|
|
self.cnt = CntSquashFsImage(dummyCnt.cnt_full_binary, offset_in_pck=0)
|
|
|
|
self.expectedHash = b'\xc3\x04\x15\xea\xccjYDit\xb7\x16\xef\xf5l\xf2\x82\x19\x81]'
|
|
|
|
def test_validateCntId(self):
|
|
self.assertEqual(21, self.cnt.cnt_id)
|
|
|
|
def test_payloadHash(self):
|
|
self.assertEqual(self.expectedHash, self.cnt.cnt_payload_hash)
|
|
|
|
def test_giveOverviewOfCnt(self):
|
|
expected = f"calc Sha1Hash: {self.expectedHash}"
|
|
|
|
_, cntData = self.cnt.output_cnt
|
|
|
|
self.assertEqual(expected, cntData[-1])
|