def test_deprecated_worker(self):
        account_sid = "AC123"
        auth_token = "foobar"
        workspace_sid = "WS456"
        worker_sid = "WK789"
        capability = TaskRouterCapability(account_sid, auth_token, workspace_sid, worker_sid)

        capability.generate_token()

        token = capability.generate_token()
        self.assertNotEqual(None, token)

        decoded = jwt.decode(token, auth_token)
        self.assertNotEqual(None, decoded)

        self.check_decoded(decoded, account_sid, workspace_sid, worker_sid, worker_sid)

        policies = decoded['policies']
        self.assertEqual(len(policies), 6)

        # should expect 6 policies
        for method, url, policy in [
            ('GET', "https://event-bridge.twilio.com/v1/wschannels/AC123/WK789", policies[0]),
            ('POST', "https://event-bridge.twilio.com/v1/wschannels/AC123/WK789", policies[1]),
            ('GET', "https://taskrouter.twilio.com/v1/Workspaces/WS456/Activities", policies[2]),
            ('GET', "https://taskrouter.twilio.com/v1/Workspaces/WS456/Tasks/**", policies[3]),
            ('GET', "https://taskrouter.twilio.com/v1/Workspaces/WS456/Workers/WK789/Reservations/**", policies[4]),
            ('GET', "https://taskrouter.twilio.com/v1/Workspaces/WS456/Workers/WK789", policies[5])
        ]:
            yield self.check_policy, method, url, policy

        # check deprecated warnings
        with warnings.catch_warnings(record=True) as w:
            warnings.simplefilter("always")
            capability.allow_worker_fetch_attributes()
            assert len(w) == 1
            assert issubclass(w[-1].category, DeprecationWarning)
            assert "deprecated" in str(w[-1].message)

        with warnings.catch_warnings(record=True) as w:
            warnings.simplefilter("always")
            capability.allow_worker_activity_updates()
            assert len(w) == 1
            assert issubclass(w[-1].category, DeprecationWarning)
            assert str(w[-1].message) in "deprecated"

        with warnings.catch_warnings(record=True) as w:
            warnings.simplefilter("always")
            capability.allow_task_reservation_updates()
            assert len(w) == 1
            assert issubclass(w[-1].category, DeprecationWarning)
            assert "deprecated" in str(w[-1].message)
dataset/ETHPy150Open twilio/twilio-python/tests/task_router/test_task_router_capability.py/TaskRouterCapabilityTest.test_deprecated_worker/swapped operands of `in`