def test_verify_block_validates_block_schema(self): fake_l4_block = { "version": "1", "dcrn": "Block::L4::AtRest", "header": { "dc_id": "43", "level": 4, "block_id": "23", "timestamp": "123445235", "l1_dc_id": "32", "l1_block_id": "423", "l1_proof": "proofity proof", "prev_proof": "some_more_proooof", }, "l3-validations": [{ "l3_dc_id": "1", "l3_block_id": "2", "l3_proof": "prooof", "valid": True }], "proof": { "scheme": "trust", "proof": "some_proof" }, } l4_block = level_5_actions.verify_block(fake_l4_block) self.assertIsNone(l4_block.get("is_invalid")) self.assertEqual(l4_block, fake_l4_block)
def test_verify_block_marks_invalid_block(self): l4_block = {"invalid!!": "this aint valid"} l4_block = level_5_actions.verify_block(l4_block) self.assertTrue(l4_block.get("is_invalid"))