Example #1
0
    def test_get_long_poll_data(self):
        client = BoxClient("my_token")

        expected_response = {
            "type": "realtime_server",
            "url": "http://2.realtime.services.box.net/subscribe?channel=e9de49a73f0c93a872d7&stream_type=all",
            "ttl": "10",
            "max_retries": "10",
            "retry_timeout": 610,
        }

        response = mocked_response({"chunk_size": 1, "entries": [expected_response]})

        (
            flexmock(requests)
            .should_receive("request")
            .with_args(
                "options", "https://api.box.com/2.0/events", headers=client.default_headers, data=None, params=None
            )
            .and_return(response)
            .once()
        )

        actual_response = client._get_long_poll_data()
        self.assertDictEqual(expected_response, actual_response)
Example #2
0
    def test_get_long_poll_data(self):
        client = BoxClient('my_token')

        expected_response = {
            'type': 'realtime_server',
            'url': 'http://2.realtime.services.box.net/subscribe?channel=e9de49a73f0c93a872d7&stream_type=all',
            'ttl': '10',
            'max_retries': '10',
            'retry_timeout': 610
        }

        response = mocked_response({
            'chunk_size': 1,
            'entries': [expected_response],
        })

        (flexmock(requests)
            .should_receive('request')
            .with_args('options', 'https://api.box.com/2.0/events', headers=client.default_headers, data=None, params=None)
            .and_return(response)
            .once())

        actual_response = client._get_long_poll_data()
        self.assertDictEqual(expected_response, actual_response)
Example #3
0
    def test_get_long_poll_data(self):
        client = BoxClient('my_token')

        expected_response = {
            'type': 'realtime_server',
            'url': 'http://2.realtime.services.box.net/subscribe?channel=e9de49a73f0c93a872d7&stream_type=all',
            'ttl': '10',
            'max_retries': '10',
            'retry_timeout': 610
        }

        response = mocked_response({
            'chunk_size': 1,
            'entries': [expected_response],
        })

        (flexmock(requests)
            .should_receive('request')
            .with_args('options', 'https://api.box.com/2.0/events', headers=client.default_headers, data=None, params=None)
            .and_return(response)
            .once())

        actual_response = client._get_long_poll_data()
        self.assertDictEqual(expected_response, actual_response)