@@ -1887,6 +1887,24 @@ def test_entitlements_aps_environment_missing_profile(self):
18871887 },
18881888 }, plist )
18891889
1890+ def test_entitlements_aps_environment_mismatch_default_validation (self ):
1891+ with self .assertRaisesRegex (
1892+ plisttool .PlistToolError ,
1893+ re .escape (plisttool .ENTITLEMENTS_VALUE_MISMATCH % (
1894+ _testing_target , 'aps-environment' , 'production' , 'development' ))):
1895+ plist = {'aps-environment' : 'production' }
1896+ self ._assert_plisttool_result ({
1897+ 'plists' : [plist ],
1898+ 'entitlements_options' : {
1899+ 'profile_metadata_file' : {
1900+ 'Entitlements' : {
1901+ 'aps-environment' : 'development' ,
1902+ },
1903+ 'Version' : 1 ,
1904+ },
1905+ },
1906+ }, plist )
1907+
18901908 def test_entitlements_aps_environment_mismatch (self ):
18911909 with self .assertRaisesRegex (
18921910 plisttool .PlistToolError ,
@@ -1896,6 +1914,9 @@ def test_entitlements_aps_environment_mismatch(self):
18961914 self ._assert_plisttool_result ({
18971915 'plists' : [plist ],
18981916 'entitlements_options' : {
1917+ 'extra_keys_to_match_profile' : [
1918+ 'aps-environment' ,
1919+ ],
18991920 'profile_metadata_file' : {
19001921 'Entitlements' : {
19011922 'aps-environment' : 'development' ,
@@ -1905,7 +1926,7 @@ def test_entitlements_aps_environment_mismatch(self):
19051926 },
19061927 }, plist )
19071928
1908- def test_attest_valid (self ):
1929+ def test_attest_valid_default_validation (self ):
19091930 plist = {
19101931 'com.apple.developer.devicecheck.appattest-environment' : 'development' }
19111932 self ._assert_plisttool_result ({
@@ -1920,6 +1941,48 @@ def test_attest_valid(self):
19201941 },
19211942 }, plist )
19221943
1944+ def test_attest_valid (self ):
1945+ plist = {
1946+ 'com.apple.developer.devicecheck.appattest-environment' : 'development' }
1947+ self ._assert_plisttool_result (
1948+ {
1949+ 'plists' : [plist ],
1950+ 'entitlements_options' : {
1951+ 'extra_keys_to_match_profile' : [
1952+ 'com.apple.developer.devicecheck.appattest-environment' ,
1953+ ],
1954+ 'profile_metadata_file' : {
1955+ 'Entitlements' : {
1956+ 'com.apple.developer.devicecheck.appattest-environment' :
1957+ ['development' , 'production' ],
1958+ },
1959+ 'Version' : 1 ,
1960+ },
1961+ },
1962+ }, plist )
1963+
1964+ def test_attest_mismatch_default_validation (self ):
1965+ with self .assertRaisesRegex (
1966+ plisttool .PlistToolError ,
1967+ re .escape (plisttool .ENTITLEMENTS_VALUE_NOT_IN_LIST %
1968+ (_testing_target ,
1969+ 'com.apple.developer.devicecheck.appattest-environment' ,
1970+ 'foo' , ['development' ]))):
1971+ plist = {'com.apple.developer.devicecheck.appattest-environment' : 'foo' }
1972+ self ._assert_plisttool_result (
1973+ {
1974+ 'plists' : [plist ],
1975+ 'entitlements_options' : {
1976+ 'profile_metadata_file' : {
1977+ 'Entitlements' : {
1978+ 'com.apple.developer.devicecheck.appattest-environment' :
1979+ ['development' ],
1980+ },
1981+ 'Version' : 1 ,
1982+ },
1983+ },
1984+ }, plist )
1985+
19231986 def test_attest_mismatch (self ):
19241987 with self .assertRaisesRegex (
19251988 plisttool .PlistToolError ,
@@ -1932,6 +1995,9 @@ def test_attest_mismatch(self):
19321995 self ._assert_plisttool_result ({
19331996 'plists' : [plist ],
19341997 'entitlements_options' : {
1998+ 'extra_keys_to_match_profile' : [
1999+ 'com.apple.developer.devicecheck.appattest-environment' ,
2000+ ],
19352001 'profile_metadata_file' : {
19362002 'Entitlements' : {
19372003 'com.apple.developer.devicecheck.appattest-environment' : ['development' ],
@@ -1989,11 +2055,28 @@ def test_entitlements_profile_missing_beta_reports_active(self):
19892055 },
19902056 }, plist )
19912057
2058+ def test_entitlements_missing_wifi_info_active_default_validation (self ):
2059+ plist = {}
2060+ self ._assert_plisttool_result ({
2061+ 'plists' : [plist ],
2062+ 'entitlements_options' : {
2063+ 'profile_metadata_file' : {
2064+ 'Entitlements' : {
2065+ 'com.apple.developer.networking.wifi-info' : True ,
2066+ },
2067+ 'Version' : 1 ,
2068+ },
2069+ },
2070+ }, plist )
2071+
19922072 def test_entitlements_missing_wifi_info_active (self ):
19932073 plist = {}
19942074 self ._assert_plisttool_result ({
19952075 'plists' : [plist ],
19962076 'entitlements_options' : {
2077+ 'extra_keys_to_match_profile' : [
2078+ 'com.apple.developer.networking.wifi-info' ,
2079+ ],
19972080 'profile_metadata_file' : {
19982081 'Entitlements' : {
19992082 'com.apple.developer.networking.wifi-info' : True ,
@@ -2003,6 +2086,25 @@ def test_entitlements_missing_wifi_info_active(self):
20032086 },
20042087 }, plist )
20052088
2089+ def test_entitlements_wifi_info_active_mismatch_default_validation (self ):
2090+ with self .assertRaisesRegex (
2091+ plisttool .PlistToolError ,
2092+ re .escape (plisttool .ENTITLEMENTS_VALUE_MISMATCH % (
2093+ _testing_target , 'com.apple.developer.networking.wifi-info' ,
2094+ 'False' , 'True' ))):
2095+ plist = {'com.apple.developer.networking.wifi-info' : False }
2096+ self ._assert_plisttool_result ({
2097+ 'plists' : [plist ],
2098+ 'entitlements_options' : {
2099+ 'profile_metadata_file' : {
2100+ 'Entitlements' : {
2101+ 'com.apple.developer.networking.wifi-info' : True ,
2102+ },
2103+ 'Version' : 1 ,
2104+ },
2105+ },
2106+ }, plist )
2107+
20062108 def test_entitlements_wifi_info_active_mismatch (self ):
20072109 with self .assertRaisesRegex (
20082110 plisttool .PlistToolError ,
@@ -2013,6 +2115,9 @@ def test_entitlements_wifi_info_active_mismatch(self):
20132115 self ._assert_plisttool_result ({
20142116 'plists' : [plist ],
20152117 'entitlements_options' : {
2118+ 'extra_keys_to_match_profile' : [
2119+ 'com.apple.developer.networking.wifi-info' ,
2120+ ],
20162121 'profile_metadata_file' : {
20172122 'Entitlements' : {
20182123 'com.apple.developer.networking.wifi-info' : True ,
@@ -2022,6 +2127,26 @@ def test_entitlements_wifi_info_active_mismatch(self):
20222127 },
20232128 }, plist )
20242129
2130+ def test_entitlements_profile_missing_wifi_info_active_default_validation (self ):
2131+ with self .assertRaisesRegex (
2132+ plisttool .PlistToolError ,
2133+ re .escape (
2134+ plisttool .ENTITLEMENTS_MISSING %
2135+ (_testing_target , 'com.apple.developer.networking.wifi-info' ))):
2136+ plist = {'com.apple.developer.networking.wifi-info' : True }
2137+ self ._assert_plisttool_result ({
2138+ 'plists' : [plist ],
2139+ 'entitlements_options' : {
2140+ 'profile_metadata_file' : {
2141+ 'Entitlements' : {
2142+ 'application-identifier' : 'QWERTY.*' ,
2143+ # No wifi-info
2144+ },
2145+ 'Version' : 1 ,
2146+ },
2147+ },
2148+ }, plist )
2149+
20252150 def test_entitlements_profile_missing_wifi_info_active (self ):
20262151 with self .assertRaisesRegex (
20272152 plisttool .PlistToolError ,
@@ -2032,6 +2157,9 @@ def test_entitlements_profile_missing_wifi_info_active(self):
20322157 self ._assert_plisttool_result ({
20332158 'plists' : [plist ],
20342159 'entitlements_options' : {
2160+ 'extra_keys_to_match_profile' : [
2161+ 'com.apple.developer.networking.wifi-info' ,
2162+ ],
20352163 'profile_metadata_file' : {
20362164 'Entitlements' : {
20372165 'application-identifier' : 'QWERTY.*' ,
0 commit comments