Exemple #1
0
    def test_verify(self):
        # {"manufacturer": {"organizationName":, "codeAccessStart":, "cvcAccessStart":},
        # "co-signer":{"organizationName":, "codeAccessStart":, "cvcAccessStart":}}
        # Format: YYYYMMDDHH[MM[SS[.fff]]]Z
        print "\n==================================================="
        print "Begin to test the normal verification process....."
        print "==================================================="
        # Case 1. Normal Case
        initcode = {
            "manufacturer": {
                "organizationName": "cisco",
                "codeAccessStart": "20160311122430Z",
                "cvcAccessStart": "20160311122430Z"
            },
            "co-signer": {
                "organizationName": "comcast",
                "codeAccessStart": "20160311122430Z",
                "cvcAccessStart": "20160311122430Z"
            }
        }

        test = CFV(initcode, self.rootca)

        # Verify MFR CVC at first
        rst = test.verify_cvc(self.mfr_cvc, True)
        print "manufacturer CVC verification result: " + str(
            rst[0]) + ", " + RST.ssdErrorMessage[rst[1]]

        if rst[0] == False:
            return

        # Verify MSO CVC
        rst = test.verify_cvc(self.mso_cvc, False)
        print "mso CVC verification result: " + str(
            rst[0]) + ", " + RST.ssdErrorMessage[rst[1]]

        if rst[0] == False:
            return

        # Get the new parameters
        print "\nGet the new initcode:"
        initcode = test.get_initcode()
        print initcode

        # Test codefile
        rst = test.verify_file(self.codefile)
        print "codefile verification result: " + str(
            rst[0]) + ", " + RST.ssdErrorMessage[rst[1]]

        if rst[0] == False:
            return

        # Get the new parameters
        print "\nGet the new initcode:"
        initcode = test.get_initcode()
        print initcode

        # Get the image
        ret = test.get_image('/tmp/testsvae', self.codefile)
        self.assertTrue(ret)

        ret = test.get_image('/tmp/', self.codefile)
        self.assertFalse(ret)