コード例 #1
0
def validate_digital_product_id(to_validate, message):
    validate_product_id(str(to_validate[8:8+23])[2:-1], message)
    
    without_product_id = to_validate
    for i in range (8, 8+23):
        without_product_id[i] = b'\x00'
    expected = b'\xa4\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb9\xec\x21\x73\x00\x00\x00\x00\x00\x00\x00\x00'
    SoftAssert.are_euqal(without_product_id, expected, message)
コード例 #2
0
def generic_test(test_type, application_type):

    if application_type == ApplicationType.APP_PROOF:
        for record in get_registry_config():
            if record.initial_value is not None:
                record.validate_format()
        SoftAssert.resolve("Proof check was successful")
        return
 

    assert type(application_type) is ApplicationType, "application_type should be Enum.ApplicationType"

    logger.info("Run generic test test_type={}, application_type={}".format(test_type, application_type))

    registry_config = get_registry_config()
    to_change = []
    to_preserve = []
    to_not_exist = []
    for record in registry_config:
        if record.initial_value is None: 
            to_not_exist.append(record)
            continue
        if record.type == test_type:
            record.corrupt()
            to_change.append(record)
        else:
            to_preserve.append(record)

    if application_type == ApplicationType.APP_PROTOTYPE:
        generate_prototype_fingerprint(test_type)
    elif application_type == ApplicationType.APP_PRODUCTION:
        generate_production_fingerprint(test_type)
    else:
        logger.warning("generic_test(test_type, application_type): application_type is out of range")

    for record in to_change:
        record.should_change()
        record.validate_format()

    for record in to_preserve:
        record.should_not_change()

    for record in to_not_exist:
        record.should_not_exist()

    SoftAssert.resolve("Test was successful: " + str(test_type))
コード例 #3
0
def validate_curl_uuid(uuid_string, message):
    SoftAssert.are_euqal(uuid_string[0], "{", message)
    SoftAssert.are_euqal(uuid_string[-1], "}", message)
    validate_uuid(uuid_string[1:-1], message)
コード例 #4
0
def validate_host_name(to_validate, message):
    SoftAssert.is_regex(to_validate, "^[a-zA-Z][a-zA-Z0-9]*$", message)
コード例 #5
0
def validate_svc_kb_number(to_validate, message):
    ListKbNumber = ["KB2841134", "KB4088835", "KB4032782", "KB4016446", "KB3210694", "KB3200006", "KB3199375", "KB3192665", "KB4096040", "KB4089187", "KB4074736", "KB4056568", "KB4052978", "KB4047206", "KB4040685", "KB4036586", "KB4034733", "KB4025252", "KB4021558", "KB4018271", "KB4014661", "KB4012204", "KB3185319", "KB3175443", "KB3170106", "KB3160005", "KB3154070", "KB3148198"]
    SoftAssert.is_in_list(to_validate, ListKbNumber, message)
コード例 #6
0
def validate_product_name(to_validate, message):
    split = to_validate.split(" ")
    name = " ".join([split[0], split[1]])
    ListProductName = ["Windows 7", "Windows 8.1", "Windows 10"]
    SoftAssert.is_in_list(name, ListProductName, message)
    validate_edition_id(split[2], message)
コード例 #7
0
def validate_uuid(to_validate, message):
    SoftAssert.is_regex(to_validate, '[0-9,a-f,A-F]{8}-[0-9,a-f,A-F]{4}-[0-9,a-f,A-F]{4}-[0-9,a-f,A-F]{4}-[0-9,a-f,A-F]{12}', message)
コード例 #8
0
def validate_product_id(to_validate, message):
    SoftAssert.is_regex(to_validate, '[0-9]{5}-[0-9,O][0-9,E][0-9,M]-[0-9]{7}-[0-9]{5}', message)
コード例 #9
0
def validate_current_version(to_validate, message):
    ListCurrentVersion = ['6.1', '7.1', '9.0']
    SoftAssert.is_in_list(to_validate, ListCurrentVersion, message)
コード例 #10
0
def validate_current_build(to_validate, message):
    ListCurrentBuild = ['7601', '9600', '16299']
    SoftAssert.is_in_list(to_validate, ListCurrentBuild, message)
コード例 #11
0
def validate_build_lab_ex(to_validate, message):
    ListBuildLabEx = ['7601.23915.amd64fre.win7sp1_ldr.170913-0600', '9600.17415.amd64fre.winblue_r4.141028-1500', '16299.15.amd64fre.rs3_release.170928-1534']
    SoftAssert.is_in_list(to_validate, ListBuildLabEx, message)
コード例 #12
0
def validate_build_lab(to_validate, message):
    ListBuildLab = ['7601.win7sp1_ldr.170913-0600', '9600.winblue_r4.141028-1500', '16299.rs3_release.170928-1534']
    SoftAssert.is_in_list(to_validate, ListBuildLab, message)
コード例 #13
0
def validate_ie_installed_date(to_validate, message):
    validate_unix_time(int.from_bytes(to_validate[0:3], byteorder='big'), message)
    SoftAssert.are_euqal(len(to_validate), 8, message)
コード例 #14
0
def validate_unix_time(to_validate, message):
    SoftAssert.is_true(to_validate < int(time.time()), message)
コード例 #15
0
 def should_not_change(self):
     SoftAssert.are_euqal(self.read(), self.initial_value,
                          self.path + " / " + self.name)
コード例 #16
0
 def should_not_exist(self):
     should_be_none = self.read()
     SoftAssert.is_true(should_be_none is None, should_be_none)
コード例 #17
0
def validate_edition_id(to_validate, message):
    ListEditionId = ["Starter", "HomeBasic", "HomePremium", "Professional", "ProfessionalN", "ProfessionalKN", "Enterprise", "Ultimate", "Core", "Pro", "ProN", "Enterprise", "EnterpriseN", "OEM", "withBing", "Home", "ProEducation", "EnterpriseLTSB", "Education", "IoTCore", "IoTEnterprise", "S"]
    SoftAssert.is_in_list(to_validate, ListEditionId, message)