diff --git a/google/api_core/iam.py b/google/api_core/iam.py index fc354693..59e53874 100644 --- a/google/api_core/iam.py +++ b/google/api_core/iam.py @@ -74,9 +74,6 @@ _ASSIGNMENT_DEPRECATED_MSG = """\ Assigning to '{}' is deprecated. Use the `policy.bindings` property to modify bindings instead.""" -_FACTORY_DEPRECATED_MSG = """\ -Factory method {0} is deprecated. Replace with '{0}'.""" - _DICT_ACCESS_MSG = """\ Dict access is not supported on policies with version > 1 or with conditional bindings.""" @@ -323,12 +320,7 @@ def user(email): Returns: str: A member string corresponding to the given user. - - DEPRECATED: set the role `user:{email}` in the binding instead. """ - warnings.warn( - _FACTORY_DEPRECATED_MSG.format("user:{email}"), DeprecationWarning, - ) return "user:%s" % (email,) @staticmethod @@ -341,12 +333,7 @@ def service_account(email): Returns: str: A member string corresponding to the given service account. - DEPRECATED: set the role `serviceAccount:{email}` in the binding instead. """ - warnings.warn( - _FACTORY_DEPRECATED_MSG.format("serviceAccount:{email}"), - DeprecationWarning, - ) return "serviceAccount:%s" % (email,) @staticmethod @@ -358,12 +345,7 @@ def group(email): Returns: str: A member string corresponding to the given group. - - DEPRECATED: set the role `group:{email}` in the binding instead. """ - warnings.warn( - _FACTORY_DEPRECATED_MSG.format("group:{email}"), DeprecationWarning, - ) return "group:%s" % (email,) @staticmethod @@ -375,12 +357,7 @@ def domain(domain): Returns: str: A member string corresponding to the given domain. - - DEPRECATED: set the role `domain:{email}` in the binding instead. """ - warnings.warn( - _FACTORY_DEPRECATED_MSG.format("domain:{email}"), DeprecationWarning, - ) return "domain:%s" % (domain,) @staticmethod @@ -389,12 +366,7 @@ def all_users(): Returns: str: A member string representing all users. - - DEPRECATED: set the role `allUsers` in the binding instead. """ - warnings.warn( - _FACTORY_DEPRECATED_MSG.format("allUsers"), DeprecationWarning, - ) return "allUsers" @staticmethod @@ -403,12 +375,7 @@ def authenticated_users(): Returns: str: A member string representing all authenticated users. - - DEPRECATED: set the role `allAuthenticatedUsers` in the binding instead. """ - warnings.warn( - _FACTORY_DEPRECATED_MSG.format("allAuthenticatedUsers"), DeprecationWarning, - ) return "allAuthenticatedUsers" @classmethod diff --git a/tests/unit/test_iam.py b/tests/unit/test_iam.py index e7835338..fbd242e5 100644 --- a/tests/unit/test_iam.py +++ b/tests/unit/test_iam.py @@ -230,72 +230,36 @@ def test_viewers_setter(self): assert policy[VIEWER_ROLE] == expected def test_user(self): - import warnings - EMAIL = "phred@example.com" MEMBER = "user:%s" % (EMAIL,) policy = self._make_one() - with warnings.catch_warnings(record=True) as warned: - assert policy.user(EMAIL) == MEMBER - - (warning,) = warned - assert warning.category is DeprecationWarning + assert policy.user(EMAIL) == MEMBER def test_service_account(self): - import warnings - EMAIL = "phred@example.com" MEMBER = "serviceAccount:%s" % (EMAIL,) policy = self._make_one() - with warnings.catch_warnings(record=True) as warned: - assert policy.service_account(EMAIL) == MEMBER - - (warning,) = warned - assert warning.category is DeprecationWarning + assert policy.service_account(EMAIL) == MEMBER def test_group(self): - import warnings - EMAIL = "phred@example.com" MEMBER = "group:%s" % (EMAIL,) policy = self._make_one() - with warnings.catch_warnings(record=True) as warned: - assert policy.group(EMAIL) == MEMBER - - (warning,) = warned - assert warning.category is DeprecationWarning + assert policy.group(EMAIL) == MEMBER def test_domain(self): - import warnings - DOMAIN = "example.com" MEMBER = "domain:%s" % (DOMAIN,) policy = self._make_one() - with warnings.catch_warnings(record=True) as warned: - assert policy.domain(DOMAIN) == MEMBER - - (warning,) = warned - assert warning.category is DeprecationWarning + assert policy.domain(DOMAIN) == MEMBER def test_all_users(self): - import warnings - policy = self._make_one() - with warnings.catch_warnings(record=True) as warned: - assert policy.all_users() == "allUsers" - - (warning,) = warned - assert warning.category is DeprecationWarning + assert policy.all_users() == "allUsers" def test_authenticated_users(self): - import warnings - policy = self._make_one() - with warnings.catch_warnings(record=True) as warned: - assert policy.authenticated_users() == "allAuthenticatedUsers" - - (warning,) = warned - assert warning.category is DeprecationWarning + assert policy.authenticated_users() == "allAuthenticatedUsers" def test_from_api_repr_only_etag(self): empty = frozenset()