예제 #1
0
def test_stats_from_model_theme_update_count():
    result = serialize_stats(
        ThemeUpdateCount(addon_id=321, date='2016-01-18', count=123))
    assert json.loads(result) == {
        'date': '2016-01-18',
        'addon': 321,
        'count': 123}
예제 #2
0
def test_stats_from_model_download_count():
    result = serialize_stats(
        DownloadCount(
            addon_id=321, date='2016-01-18', count=123,
            sources={u'search': 1, u'collection': 1}))
    assert json.loads(result) == {
        'date': '2016-01-18',
        'addon': 321,
        'count': 123,
        'sources': {'search': 1, 'collection': 1}}
예제 #3
0
def test_stats_from_model_update_count():
    result = serialize_stats(
        UpdateCount(
            addon_id=321, date='2016-01-18',
            count=123,
            versions={u'3.8': 2, u'3.7': 3},
            statuses={u'userEnabled': 5},
            applications={u'{ec8030f7-c20a-464f-9b0e-13a3a9e97384}':
                          {u'3.6': 18}},
            oses={u'WINNT': 5},
            locales={u'en-us': 1, u'en-US': 4}))
    assert json.loads(result) == {
        'date': '2016-01-18',
        'addon': 321,
        'count': 123,
        'versions': {'3.7': 3, '3.8': 2},
        'oses': {'WINNT': 5},
        'applications': {
            '{ec8030f7-c20a-464f-9b0e-13a3a9e97384}': {'3.6': 18}},
        'locales': {'en-US': 4, 'en-us': 1},
        'statuses': {'userEnabled': 5}}