Esempio n. 1
0
def test_areena_series(botmock):
    regex = u"Title: Kummeli \[SERIES - 54 episodes - latest episode: %s\]" % (
        age_str_regex)
    msg = "http://areena.yle.fi/1-3339547"
    check_re(
        regex,
        module_urltitle.handle_url(botmock, None, "#channel", msg, msg)[1])
Esempio n. 2
0
def test_areena_series():
    regex = u'Title: (.*?) \[SERIES - \d+ episodes - latest episode: %s\]' % (
        age_str_regex)
    msg = "http://areena.yle.fi/tv/2129619"
    module_urltitle.init(bot)
    check_re(regex,
             module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
Esempio n. 3
0
def test_areena_tv():
    regex = u'Title: (.*?) \[%s - %s plays - %s( - exits in \d+ (weeks|days|hours|minutes))?\]' % (
        lengh_str_regex, views_str_regex, age_str_regex)
    msg = "http://areena.yle.fi/tv/1999860"
    module_urltitle.init(bot)
    check_re(regex,
             module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
Esempio n. 4
0
def test_posti():
    '''11d 1h 45m ago - Item delivered to the recipient. - TAALINTEHDAS 25900'''
    regex = u'(\d+d\ )?(\d+h\ )?(\d+m )?ago - (.*?) - (.*? )?(\d+)'
    check_re(
        regex,
        command_posti(bot, '[email protected]', '#example',
                      'JJFI')[1])
Esempio n. 5
0
def test_liveleak():
    regex = "Title: (.*?) by (.*?) \[%s views - Jul-23-2013 - tags\: sword, cut, hand, watermelon, fail\]" % (
        views_str_regex
    )
    msg = "http://www.liveleak.com/view?i=f8e_1374614129"
    module_urltitle.init(bot)
    check_re(regex, module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
Esempio n. 6
0
def test_vimeo():
    regex = 'Title: (.*?) by (.*?) \[%s - %s likes - %s views - %s]' % (
        lengh_str_regex, views_str_regex, views_str_regex, age_str_regex)
    msg = 'http://vimeo.com/29996808'
    module_urltitle.init(bot)
    check_re(regex,
             module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
Esempio n. 7
0
def test_simple():
    module_wolfram_alpha.init(bot)
    query = "42"
    # Wolfram Alpha seems to randomly return also Roman numerals
    regex = u"(42 = forty-two|forty-two = XLII)"
    result = module_wolfram_alpha.command_wa(bot, None, "#channel", query)[1]
    check_re(regex, result)
Esempio n. 8
0
def test_areena_not_available(botmock):
    regex = u"Title: (.*?) \[%s - %s - not available\]" % (
        length_str_regex,
        age_str_regex,
    )
    msg = "http://areena.yle.fi/1-2372901"
    check_re(regex, module_urltitle.handle_url(botmock, None, "#channel", msg, msg)[1])
Esempio n. 9
0
def test_liveleak():
    regex = 'Title: (.*?) by (.*?) \[%s views - Jul-23-2013 - tags\: sword, cut, hand, watermelon, fail\]' % (
        views_str_regex)
    msg = 'http://www.liveleak.com/view?i=f8e_1374614129'
    module_urltitle.init(bot)
    check_re(regex,
             module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
Esempio n. 10
0
def test_simple():
    module_wolfram_alpha.init(bot)
    query = "42"
    # Wolfram Alpha seems to randomly return also Roman numerals
    regex = u"(42 = forty-two|forty-two = XLII)"
    result = module_wolfram_alpha.command_wa(bot, None, "#channel", query)[1]
    check_re(regex, result)
Esempio n. 11
0
def test_youtube():
    regex = 'Title: (.*?) by (.*?) \[%s - \[\** *\] - %s views - %s( - XXX)?\]' % (
        lengh_str_regex, views_str_regex, age_str_regex)
    msg = "http://www.youtube.com/watch?v=awsolTK175c"
    module_urltitle.init(bot)
    check_re(regex,
             module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
Esempio n. 12
0
def test_areena_tv_exiting(botmock):
    regex = u"Title: (.*?) \[%s - %s( - exits in %s)?\]" % (
        length_str_regex,
        age_str_regex,
        age_str_regex,
    )
    msg = "http://areena.yle.fi/1-3093932"
    check_re(regex, module_urltitle.handle_url(botmock, None, "#channel", msg, msg)[1])
Esempio n. 13
0
def test_areena_not_available(botmock):
    regex = u"Title: (.*?) \[%s - %s - not available\]" % (
        length_str_regex,
        age_str_regex,
    )
    msg = "http://areena.yle.fi/1-2372901"
    check_re(
        regex,
        module_urltitle.handle_url(botmock, None, "#channel", msg, msg)[1])
Esempio n. 14
0
def test_youtube():
    regex = "Title: (.*?) by (.*?) \[%s - %s views - %s( - age restricted)?\]" % (
        lengh_str_regex,
        views_str_regex,
        age_str_regex,
    )
    msg = "http://www.youtube.com/watch?v=awsolTK175c"
    module_urltitle.init(bot)
    check_re(regex, module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
Esempio n. 15
0
def test_youtube(botmock):
    regex = "Title: (.*?) by (.*?) \[%s - %s views - %s( - age restricted)?\]" % (
        lengh_str_regex,
        views_str_regex,
        age_str_regex,
    )
    msg = "http://www.youtube.com/watch?v=awsolTK175c"
    module_urltitle.init(botmock)
    check_re(regex, __handle_url(botmock, msg))
Esempio n. 16
0
def test_vimeo(botmock):
    regex = "Title: (.*?) by (.*?) \[%s - %s likes - %s views - %s]" % (
        lengh_str_regex,
        views_str_regex,
        views_str_regex,
        age_str_regex,
    )
    msg = "http://vimeo.com/29996808"
    check_re(regex, __handle_url(botmock, msg))
Esempio n. 17
0
def test_areena_tv_exiting(botmock):
    regex = u"Title: (.*?) \[%s - %s( - exits in %s)?\]" % (
        length_str_regex,
        age_str_regex,
        age_str_regex,
    )
    msg = "http://areena.yle.fi/1-3093932"
    check_re(
        regex,
        module_urltitle.handle_url(botmock, None, "#channel", msg, msg)[1])
Esempio n. 18
0
def test_areena_tv_exiting_in_far_far_future(botmock):
    from datetime import datetime

    if datetime.utcnow() < datetime(2098, 1, 1):
        regex = u'Title: Kummeli - 5x03 \[%s - %s\]' % (length_str_regex, age_str_regex)
    else:
        regex = u'Title: Kummeli - 5x03 \[%s - %s( - exits in %s)?\]' % (length_str_regex, age_str_regex, age_str_regex)

    msg = "http://areena.yle.fi/1-1823488"
    check_re(regex, module_urltitle.handle_url(botmock, None, "#channel", msg, msg)[1])
Esempio n. 19
0
def test_vimeo():
    regex = "Title: (.*?) by (.*?) \[%s - %s likes - %s views - %s]" % (
        lengh_str_regex,
        views_str_regex,
        views_str_regex,
        age_str_regex,
    )
    msg = "http://vimeo.com/29996808"
    module_urltitle.init(bot)
    check_re(regex, module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
Esempio n. 20
0
def test_areena_tv_exiting_in_far_far_future(botmock):
    from datetime import datetime

    if datetime.utcnow() < datetime(2098, 1, 1):
        regex = u"Title: Kummeli - 5x03 \[%s - %s\]" % (length_str_regex,
                                                        age_str_regex)
    else:
        regex = u"Title: Kummeli - 5x03 \[%s - %s( - exits in %s)?\]" % (
            length_str_regex,
            age_str_regex,
            age_str_regex,
        )

    msg = "http://areena.yle.fi/1-1823488"
    check_re(
        regex,
        module_urltitle.handle_url(botmock, None, "#channel", msg, msg)[1])
Esempio n. 21
0
def test_areena_series():
    regex = u'Title: (.*?) \[SERIES - \d+ episodes - latest episode: %s\]' % (age_str_regex)
    msg = "http://areena.yle.fi/1-2540167"
    module_urltitle.init(bot)
    check_re(regex, module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
Esempio n. 22
0
def test_weather():
    regex = u'(Lappeenranta, (Finland|FI): Temperature: -?\d+.\d\xb0C, feels like: -?\d+.\d\xb0C, wind: \d+.\d m/s, humidity: \d+%, pressure: \d+ hPa, cloudiness: \d+%)|(Error: API error.)'
    check_re(regex, module_openweather.command_weather(bot, None, "#channel", 'lappeenranta')[1])
Esempio n. 23
0
def test_add_feed():
    check_re(
        r'feed added with \d+ items',
        command_rss(
            bot, ADMIN_USER, '#pyfibot',
            'add http://feeds.feedburner.com/ampparit-kaikki?format=xml')[1])
Esempio n. 24
0
def test_areena_series(botmock):
    regex = u"Title: Kummeli \[SERIES - 54 episodes - latest episode: %s\]" % (
        age_str_regex
    )
    msg = "http://areena.yle.fi/1-3339547"
    check_re(regex, module_urltitle.handle_url(botmock, None, "#channel", msg, msg)[1])
Esempio n. 25
0
def test_youtube():
    regex = 'Title: (.*?) by (.*?) \[%s - \[\**\] - %s views - %s( - XXX)?\]' % (lengh_str_regex, views_str_regex, age_str_regex)
    msg = "http://www.youtube.com/watch?v=awsolTK175c"
    module_urltitle.init(bot)
    assert check_re(regex, module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
Esempio n. 26
0
def test_alko():
    regex = 'Title: Sandels IV A tölkki \[\d\.\d\de, \d\.\d\dl, \d\.\d\de/l, oluet, 5\.30\%\]'
    msg = 'http://www.alko.fi/tuotteet/798684/'
    module_urltitle.init(bot)
    check_re(regex,
             module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
Esempio n. 27
0
def test_verkkokauppacom(botmock):
    msg = "http://www.verkkokauppa.com/fi/product/55124/dfbfn/Coca-Cola-Vanilla-USA-virvoitusjuoma-355-ml"
    regex = "Title: Coca-Cola Vanilla USA virvoitusjuoma 355 ml \| \d+,\d+ € \(.*?\)"
    check_re(regex, __handle_url(botmock, msg))
Esempio n. 28
0
def test_areena_live(botmock):
    regex = u"Title: Yle TV2 - (.*?)( <http://areena.yle.fi/\d-\d+>)? \(LIVE\)"
    msg = "http://areena.yle.fi/tv/suora/tv2"
    check_re(
        regex,
        module_urltitle.handle_url(botmock, None, "#channel", msg, msg)[1])
Esempio n. 29
0
def test_weather():
    regex = u'Lappeenranta, FI: Temperature: \d+.\d\xb0C, feels like: \d+.\d\xb0C, wind: \d+.\d m/s, humidity: \d+%, pressure: \d+ hPa, cloudiness: \d+%'
    check_re(regex, module_openweather.command_weather(bot, None, "#channel", 'lappeenranta')[1])
Esempio n. 30
0
def test_forecast():
    regex = u'Lappeenranta, FI: tomorrow: \d+.\d-\d+.\d \xb0C \(.*?\), in 2 days: \d+.\d-\d+.\d \xb0C \(.*?\), in 3 days: \d+.\d-\d+.\d \xb0C \(.*?\)'
    check_re(regex, module_openweather.command_forecast(bot, None, "#channel", 'lappeenranta')[1])
Esempio n. 31
0
def test_dx():
    regex = u'Title: Wireless Bluetooth Audio Music Receiver Adapter - Black \[\d+\.\d+e - \[\** *\] - \d+ reviews\]'
    msg = 'http://dx.com/p/wireless-bluetooth-audio-music-receiver-adapter-black-151659'
    module_urltitle.init(bot)
    check_re(regex, module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
Esempio n. 32
0
def test_weather():
    regex = u'(Lappeenranta, (Finland|FI): Temperature: -?\d+.\d\xb0C, feels like: -?\d+.\d\xb0C, wind: \d+.\d m/s, humidity: \d+%, pressure: \d+ hPa, cloudiness: \d+%)|(Error: API error.)'
    check_re(
        regex,
        module_openweather.command_weather(bot, None, "#channel",
                                           'lappeenranta')[1])
Esempio n. 33
0
def test_ebay_cgi():
    msg = 'http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=121136837564'
    regex = 'Title: .*? \[\d+\.\de - over \d+ available - ships from .*?\]'
    module_urltitle.init(bot)
    check_re(regex,
             module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
Esempio n. 34
0
def test_verkkokauppacom():
    msg = "http://www.verkkokauppa.com/fi/product/34214/dkqht/Sony-NEX-3N-mikrojarjestelmakamera-16-50-mm-objektiivi-musta"
    module_urltitle.init(bot)
    regex = 'Title: Sony NEX-3N mikrojärjestelmäkamera \+ 16-50 mm objektiivi, musta \| \d+,\d+ € \(.*?\)'
    check_re(regex,
             module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
Esempio n. 35
0
def test_imdb():
    regex = 'Title: Wreck-It Ralph \(2012\) - [\d.]{1,}/10 \(%s votes\) - .*' % views_str_regex
    msg = "http://www.imdb.com/title/tt1772341/"
    module_urltitle.init(bot)
    check_re(regex,
             module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
Esempio n. 36
0
def test_gfycat_reddit_title(botmock):
    regex = "Title: California Sunset \(/r/NatureGifs\) 1280x720@29fps \d+ views"
    msg = "http://www.gfycat.com/ZanyFragrantHoneyeater"
    check_re(regex, __handle_url(botmock, msg))
Esempio n. 37
0
def test_command_add():
    check_re(
        r'feed added with \d+ items',
        command_rss(bot, ADMIN_USER, '#pyfibot',
                    'add ./tests/static/test_rss_init.xml')[1])
Esempio n. 38
0
def test_gfycat_own_title(botmock):
    regex = "Title: Star Trail's in the Desert 632x480@30fps \d+ views"
    msg = "https://www.gfycat.com/EcstaticWelllitHarpseal"
    check_re(regex, __handle_url(botmock, msg))
Esempio n. 39
0
def test_areena_live(botmock):
    regex = u"Title: Yle TV2 - (.*?)( <http://areena.yle.fi/\d-\d+>)? \(LIVE\)"
    msg = "http://areena.yle.fi/tv/suora/tv2"
    check_re(regex, module_urltitle.handle_url(botmock, None, "#channel", msg, msg)[1])
Esempio n. 40
0
def test_forecast():
    regex = u'(Lappeenranta, (Finland|FI): tomorrow: -?\d+.\d - -?\d+.\d \xb0C \(.*?\), in 2 days: -?\d+.\d - -?\d+.\d \xb0C \(.*?\), in 3 days: -?\d+.\d - -?\d+.\d \xb0C \(.*?\))|(Error: API error.)'
    check_re(
        regex,
        module_openweather.command_forecast(bot, None, "#channel",
                                            'lappeenranta')[1])
Esempio n. 41
0
def test_forecast():
    regex = u'(Lappeenranta, (Finland|FI): tomorrow: -?\d+.\d - -?\d+.\d \xb0C \(.*?\), in 2 days: -?\d+.\d - -?\d+.\d \xb0C \(.*?\), in 3 days: -?\d+.\d - -?\d+.\d \xb0C \(.*?\))|(Error: API error.)'
    check_re(regex, module_openweather.command_forecast(bot, None, "#channel", 'lappeenranta')[1])
Esempio n. 42
0
def test_add_feed():
    check_re(
        r'feed added with \d+ items',
        command_rss(bot, ADMIN_USER, '#pyfibot', 'add http://feeds.feedburner.com/ampparit-kaikki?format=xml')[1]
    )
Esempio n. 43
0
def test_areena_tv():
    regex = u'Title: (.*?) \[%s - %s plays - %s( - exits in \d+ (weeks|days|hours|minutes))?\]' % (lengh_str_regex, views_str_regex, age_str_regex)
    msg = "http://areena.yle.fi/1-1999860"
    module_urltitle.init(bot)
    check_re(regex, module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
Esempio n. 44
0
def test_gfycat_direct_url(botmock):
    regex = "Title: \(/r/NatureGifs\) 270x480@30fps \d+ views"
    msg = "https://zippy.gfycat.com/QualifiedSpanishAmericankestrel.webm"
    check_re(regex, __handle_url(botmock, msg))
Esempio n. 45
0
def test_areena_live():
    regex = u'Title: Yle TV2 - (.*?)( <http://areena.yle.fi/\d-\d+>)? \(LIVE\)'
    msg = "http://areena.yle.fi/tv/suora/tv2"
    module_urltitle.init(bot)
    check_re(regex, module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
Esempio n. 46
0
def test_youtube(botmock):
    regex = 'Title: (.*?) by (.*?) \[%s - %s views - %s( - age restricted)?\]' % (lengh_str_regex, views_str_regex, age_str_regex)
    msg = "http://www.youtube.com/watch?v=awsolTK175c"
    module_urltitle.init(botmock)
    check_re(regex, __handle_url(botmock, msg))
Esempio n. 47
0
def test_ebay_cgi(botmock):
    msg = "http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=121136837564"
    regex = "Title: .*? \[\d+\.\de - over \d+ available - ships from .*?\ - ENDED]"
    check_re(regex, __handle_url(botmock, msg))
Esempio n. 48
0
def test_http_artist(botmock):
    msg = 'http://open.spotify.com/artist/3MXhtYDNuzQQmLfOKFgPiI'
    regex = '\[Spotify\] Einojuhani Rautavaara( \(Genre: \S.+\))?'
    check_re(regex, handle_privmsg(botmock, None, '#channel', msg)[1])
Esempio n. 49
0
def test_alko():
    regex = u'Title: Sandels IV A tölkki \[\d\.\d\de, \d\.\d\dl, \d\.\d\de/l, oluet, 5\.30\%\]'
    msg = 'http://www.alko.fi/tuotteet/798684/'
    module_urltitle.init(bot)
    check_re(regex, module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
Esempio n. 50
0
def test_ebay():
    msg = 'https://ebay.com/itm/390629338875'
    regex = u'Title: .*? \[\d+\.\de \(postage \d+\.\de\) - over \d+ available - ships from .*?\]'
    module_urltitle.init(bot)
    check_re(regex, module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
Esempio n. 51
0
def test_ebay():
    msg = 'https://ebay.com/itm/390629338875'
    regex = 'Title: .*? \[\d+\.\de \(postage \d+\.\de\) - over \d+ available - ships from .*?\]'
    module_urltitle.init(bot)
    check_re(regex,
             module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
Esempio n. 52
0
def test_ebay_cgi():
    msg = 'http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=121136837564'
    regex = u'Title: .*? \[\d+\.\de - over \d+ available - ships from .*?\]'
    module_urltitle.init(bot)
    check_re(regex, module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
Esempio n. 53
0
def test_dx():
    regex = 'Title: Wireless Bluetooth Audio Music Receiver Adapter - Black \[\d+\.\d+e - \[\** *\] - \d+ reviews\]'
    msg = 'http://dx.com/p/wireless-bluetooth-audio-music-receiver-adapter-black-151659'
    module_urltitle.init(bot)
    check_re(regex,
             module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
Esempio n. 54
0
def test_areena_tv():
    regex = 'Title: (.*?) \[\d+ min - \d+ plays - %s( - exits in \d+ (weeks|days|hours|minutes))?\]' % (age_str_regex)
    msg = "http://areena.yle.fi/tv/1999860"
    module_urltitle.init(bot)
    assert check_re(regex, module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
Esempio n. 55
0
def test_gfycat_direct_url(botmock):
    regex = "Title: \(/r/NatureGifs\) 270x480@30fps \d+ views"
    msg = "https://zippy.gfycat.com/QualifiedSpanishAmericankestrel.webm"
    check_re(regex, __handle_url(botmock, msg))
Esempio n. 56
0
def test_http_artist():
    msg = 'http://open.spotify.com/artist/3MXhtYDNuzQQmLfOKFgPiI'
    regex = '\[Spotify\] Einojuhani Rautavaara( \(Genre: \S.+\))?'
    check_re(regex, handle_privmsg(bot, None, '#channel', msg)[1])
Esempio n. 57
0
def test_posti():
    '''11d 1h 45m ago - Item delivered to the recipient. - TAALINTEHDAS 25900'''
    regex = u'(\d+d\ )?(\d+h\ )?(\d+m )?ago - (.*?) - (.*?) (\d+)'
    check_re(regex, command_posti(bot, '[email protected]', '#example', 'JJFI')[1])
Esempio n. 58
0
def test_verkkokauppacom(botmock):
    msg = "http://www.verkkokauppa.com/fi/product/55124/dfbfn/Coca-Cola-Vanilla-USA-virvoitusjuoma-355-ml"
    regex = 'Title: Coca-Cola Vanilla USA virvoitusjuoma 355 ml \| \d+,\d+ € \(.*?\)'
    check_re(regex, __handle_url(botmock, msg))
Esempio n. 59
0
def test_command_add():
    check_re(
        r'feed added with \d+ items',
        command_rss(bot, ADMIN_USER, '#pyfibot', 'add ./tests/static/test_rss_init.xml')[1]
    )
Esempio n. 60
0
def test_imdb(botmock):
    regex = 'Title: Wreck-It Ralph \(2012\) - [\d.]{1,}/10 \(%s votes\) - .*' % views_str_regex
    msg = "http://www.imdb.com/title/tt1772341/"
    check_re(regex, __handle_url(botmock, msg))