<commit_before>from datetime import datetime
import json

from usb.models import db, DeviceType, Redirect
from usb.tests.base import APITestCase


class GetListOfUrls(APITestCase):

    def test_get_list_of_urls(self):
        dt = datetime.now()
        dt_str = dt.isoformat()
        redirects = (
            Redirect('aaaaaaaa', DeviceType.DESKTOP, 'http://domain1.com/path?q=a', count=10, datetime=dt),
            Redirect('aaaaaaaa', DeviceType.TABLET, 'http://tablet.domain1.com/path?q=a', count=20, datetime=dt),
            Redirect('aaaaaaaa', DeviceType.MOBILE, 'http://mobile.domain1.com/path?q=a', count=30, datetime=dt),
            Redirect('bbbbbbbb', DeviceType.DESKTOP, 'http://domain2.com/path/b', count=40, datetime=dt),
            Redirect('bbbbbbbb', DeviceType.TABLET, 'http://tablet.domain2.com/path/b', count=5, datetime=dt),
            Redirect('bbbbbbbb', DeviceType.MOBILE, 'http://mobile.domain2.com/path/b', count=15, datetime=dt),
            Redirect('cccccccc', DeviceType.DESKTOP, 'http://domain1.com/path?q=a', count=1, datetime=dt),
            Redirect('cccccccc', DeviceType.TABLET, 'http://domain1.com/path?q=a', count=2, datetime=dt),
            Redirect('cccccccc', DeviceType.MOBILE, 'http://domain1.com/path?q=a', count=3, datetime=dt)
        )
        for redirect in redirects:
            db.session.add(redirect)
        db.session.commit()<commit_msg>Refactor list of urls API method tests according new polymorphic models approach<commit_after>from datetime import datetime
import json

from usb.models import db, Desktop, Tablet, Mobile
from usb.tests.base import APITestCase


class GetListOfUrls(APITestCase):

    def test_get_list_of_urls(self):
        dt = datetime.now()
        dt_str = dt.isoformat()
        redirects = (
            Desktop('aaaaaaaa', 'http://domain1.com/path?q=a', dt, 10),
            Tablet('aaaaaaaa', 'http://tablet.domain1.com/path?q=a', dt, 20),
            Mobile('aaaaaaaa', 'http://mobile.domain1.com/path?q=a', dt, 30),
            Desktop('bbbbbbbb', 'http://domain2.com/path/b', dt, 40),
            Tablet('bbbbbbbb', 'http://tablet.domain2.com/path/b', dt, 5),
            Mobile('bbbbbbbb', 'http://mobile.domain2.com/path/b', dt, 15),
            Desktop('cccccccc', 'http://domain1.com/path?q=a', dt, 1),
            Tablet('cccccccc', 'http://domain1.com/path?q=a', dt, 2),
            Mobile('cccccccc', 'http://domain1.com/path?q=a', dt, 3)
        )
        for redirect in redirects:
            db.session.add(redirect)
        db.session.commit()
{'fraction_non_alphanumeric': 0.1607981220657277, 'fraction_numerical': 0.017996870109546165, 'mean_word_length': 3.065182829888712, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 18, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7472419', 'n_tokens_mistral': 865, 'n_tokens_neox': 827, 'n_words': 154}