예제 #1
0
    def test_get_trending(self, _mock):
        client = mock.Mock()
        client.raw.return_value = {
            'aggregations': {
                'popular': {
                    'total_installs': {
                        'value': 123
                    }
                },
                'region': {
                    'buckets': [{
                        'key': 'br',
                        'popular': {
                            'total_installs': {
                                'value': 12
                            }
                        }
                    }]
                }
            }
        }
        _mock.return_value = client

        eq_(_get_installs(self.app.id)['all'], 123.0)
        eq_(_get_installs(self.app.id)['br'], 12.0)
예제 #2
0
    def test_get_trending(self, _mock):
        client = mock.Mock()
        client.raw.return_value = {
            'aggregations': {
                'popular': {'total_installs': {'value': 123}},
                'region': {
                    'buckets': [
                        {
                            'key': 'br',
                            'popular': {'total_installs': {'value': 12}}
                        }
                    ]
                }
            }
        }
        _mock.return_value = client

        eq_(_get_installs(self.app.id)['all'], 123.0)
        eq_(_get_installs(self.app.id)['br'], 12.0)
예제 #3
0
    def test_get_installs_error(self, _mock):
        client = mock.Mock()
        client.raw.side_effect = ValueError
        _mock.return_value = client

        eq_(_get_installs(self.app.id), {})
예제 #4
0
    def test_get_installs_error(self, _mock):
        client = mock.Mock()
        client.raw.side_effect = ValueError
        _mock.return_value = client

        eq_(_get_installs(self.app.id), {})