예제 #1
0
    def test_get_events(self, requests):
        requests.get = Mock(
            return_value=self.get_mock_response(
                [
                    {
                        'data': {},
                        'timestamp': self.dts
                    }
                ]
            )
        )

        client = SkyClient()
        table = resources.Table(name='users')
        events = client.get_events(table, 123)

        requests.get.assert_called_once_with(
            'http://127.0.0.1:8585/tables/users/objects/123/events',
            headers={'content-type': 'application/json'},
            data=None
        )

        self.assertEquals(events[0].timestamp, self.dt)