def check18():
    '''
    check18 - Locate the "archived-expanded-entitlements.xcent"
    :return:
    '''

    logging.info("Check 18: Locate the 'archived-expanded-entitlements.xcent'")

    fileName = rootFolder + "PlugIns/GLAExtensionWatchKit.appex/archived-expanded-entitlements.xcent"

    checkMethods.checkFileExists(fileName)

    try:
        data = checkMethods.loadPlist(fileName)

        checkMethods.checkValue(
                "com.apple.security.application-groups",
                ["group.uk.co.guardian.iphone2"],
                data["com.apple.security.application-groups"]
        )

        checkMethods.checkValue(
                "keychain-access-groups",
                ["U9LTYR56M6.uk.co.guardian.SharedKeychain"],
                data["keychain-access-groups"]
        )
        logging.info('\n')
    except IOError:
        logging.error("ERROR file missing: " + fileName)
        sys.exit(1)
def check21():
    '''
    check21 - Locate the "archived-expanded-entitlements.xcent"
    :return:
    '''

    logging.info("Check 21: Locate the 'archived-expanded-entitlements.xcent'")

    fileName = rootFolder + "PlugIns/GLAExtensionWatchKit.appex/GLAWatchApp.app/archived-expanded-entitlements.xcent"

    checkMethods.checkFileExists(fileName)

    try:
        data = checkMethods.loadPlist(fileName)

        checkMethods.checkValue(
                "application-identifier",
                "U9LTYR56M6.uk.co.guardian.iphone2.watchapp",
                data["application-identifier"]
        )

        checkMethods.checkValue(
                "keychain-access-groups",
                ["U9LTYR56M6.uk.co.guardian.iphone2.watchapp"],
                data["keychain-access-groups"]
        )
        logging.info('\n')
    except IOError:
        logging.error("ERROR file missing: " + fileName)
        sys.exit(1)
def check3():
    '''
    check3 - Locate the "archived-expanded-entitlements.xcent)
    '''
    logging.info('\n')
    logging.info("Check 3: Locate the 'archived-expanded-entitlements.xcent'")

    fileName = rootFolder + "archived-expanded-entitlements.xcent"

    checkMethods.checkFileExists(fileName)

    try:
        data = checkMethods.loadPlist(fileName)

        checkMethods.checkListAny(
                "com.apple.developer.associated-domains",
                ["activitycontinuation:www.theguardian.com", "applinks:www.theguardian.com"],
                data["com.apple.developer.associated-domains"]
        )

        checkMethods.checkValue(
                "com.apple.security.application-groups",
                ["group.uk.co.guardian.iphone2"],
                data["com.apple.security.application-groups"]
        )

        checkMethods.checkValue(
                "keychain-access-groups",
                ["U9LTYR56M6.uk.co.guardian.SharedKeychain"],
                data["keychain-access-groups"]
        )
        logging.info('\n')
    except IOError:
        logging.error("ERROR file missing: " + fileName)
        sys.exit(1)
def check20():
    '''
    check20 - Locate the "Info.plist"
    '''

    logging.info("Check 20: Locate the 'Info.plist'")

    fileName = rootFolder + "PlugIns/GLAExtensionWatchKit.appex/Info.plist"

    checkMethods.checkFileExists(fileName)

    try:
        data = checkMethods.loadPlist(fileName)

        checkMethods.checkValue(
                "CFBundleIdentifier",
                "uk.co.guardian.iphone2.extw",
                data["CFBundleIdentifier"]
        )

        checkMethods.checkValue(
                "CFBundleShortVersionString",
                CFBundleShortVersionString,
                data["CFBundleShortVersionString"]
        )

        checkMethods.checkValue(
                "CFBundleVersion",
                CFBundleVersion,
                data["CFBundleVersion"]
        )

        application_groups = data["NSExtension"]["NSExtensionAttributes"]["WKAppBundleIdentifier"]
        checkMethods.checkValue(
                "WKAppBundleIdentifier",
                "uk.co.guardian.iphone2.watchapp",
                application_groups
        )

        checkMethods.checkListAny(
                "UIDeviceFamily",
                [1],
                data["UIDeviceFamily"]
        )
        logging.info('\n')
    except IOError:
        logging.error("ERROR file missing: " + fileName)
        sys.exit(1)
def check10():
    '''
    check10 - Locate the "Info.plist"
    '''

    logging.info("Check 10: Locate the 'Info.plist'")

    fileName = rootFolder + "Watch/GLAWatchApp2.app/Info.plist"

    checkMethods.checkFileExists(fileName)

    try:
        data = checkMethods.loadPlist(fileName)

        checkMethods.checkValue(
                "CFBundleIdentifier",
                "uk.co.guardian.iphone2.watchapp",
                data["CFBundleIdentifier"]
        )

        checkMethods.checkValue(
                "CFBundleShortVersionString",
                CFBundleShortVersionString,
                data["CFBundleShortVersionString"]
        )

        checkMethods.checkValue(
                "CFBundleVersion",
                CFBundleVersion,
                data["CFBundleVersion"]
        )

        checkMethods.checkValue(
                "WKCompanionAppBundleIdentifier",
                "uk.co.guardian.iphone2",
                data["WKCompanionAppBundleIdentifier"]
        )

        checkMethods.checkValue(
                "UIDeviceFamily",
                [4],
                data["UIDeviceFamily"]
        )
        logging.info('\n')
    except IOError:
        logging.error("ERROR file missing: " + fileName)
        sys.exit(1)
def check6():
    '''
    check6 - Locate the "Info.plist"
    '''

    logging.info("Check 6: Locate the 'Info.plist'")

    fileName = rootFolder + "Info.plist"

    checkMethods.checkFileExists(fileName)

    try:
        data = checkMethods.loadPlist(fileName)

        checkMethods.checkValue(
                "BuildTier",
                "release",
                data["BuildTier"]
        )

        checkMethods.checkValue(
                "CFBundleIdentifier",
                "uk.co.guardian.iphone2",
                data["CFBundleIdentifier"]
        )

        checkMethods.checkValue(
                "CFBundleShortVersionString",
                CFBundleShortVersionString,
                data["CFBundleShortVersionString"]
        )

        checkMethods.checkValue(
                "CFBundleVersion",
                CFBundleVersion,
                data["CFBundleVersion"]
        )

        checkMethods.checkListAny(
                "UIDeviceFamily",
                [1, 2],
                data["UIDeviceFamily"]
        )
    except IOError:
        logging.error("ERROR file missing: " + fileName)
        sys.exit(1)
def check17():
    '''
    check17 - Locate the "Info.plist"
    '''

    logging.info("Check 17: Locate the 'Info.plist'")

    fileName = rootFolder + "PlugIns/GLAExtensionToday.appex/Info.plist"

    checkMethods.checkFileExists(fileName)

    try:

        data = checkMethods.loadPlist(fileName)

        checkMethods.checkValue(
                "CFBundleIdentifier",
                "uk.co.guardian.iphone2.extt",
                data["CFBundleIdentifier"]
        )

        checkMethods.checkValue(
                "CFBundleShortVersionString",
                CFBundleShortVersionString,
                data["CFBundleShortVersionString"]
        )

        checkMethods.checkValue(
                "CFBundleVersion",
                CFBundleVersion,
                data["CFBundleVersion"]
        )

        checkMethods.checkListAny(
                "UIDeviceFamily",
                [1, 2],
                data["UIDeviceFamily"]
        )
        logging.info('\n')
    except IOError:
        logging.error("ERROR file missing: " + fileName)
        sys.exit(1)