Beispiel #1
0
    def inner(useragent,
              version,
              model,
              packet_compliant,
              serial_number=None,
              vendor=None,
              vendor_version=None,
              java_infos=None):
        ua = detect({'HTTP_USER_AGENT': useragent})

        assert ua.carrier == 'SoftBank'
        assert ua.short_carrier == 'S'

        assert ua.is_docomo() == False
        assert ua.is_ezweb() == False
        assert ua.is_softbank()
        assert ua.is_vodafone()
        assert ua.is_jphone()
        assert ua.is_willcom() == False
        assert ua.is_nonmobile() == False
        assert ua.display is not None

        if serial_number:
            assert ua.serialnumber == serial_number, msg(
                ua, ua.serialnumber, serial_number)
            assert ua.version == version
            assert ua.model == model, msg(ua, ua.model, model)
            assert ua.packet_compliant == packet_compliant

            assert ua.vendor == vendor, msg(ua, ua.vendor, vendor)
            assert ua.vendor_version == vendor_version, msg(
                ua, ua.vendor_version, vendor_version)
Beispiel #2
0
 def inner(useragent, version, model, device_id, server, xhtml_compliant, comment, is_wap1, is_wap2, is_win):
     ua = detect({'HTTP_USER_AGENT':useragent})
     assert ua.carrier == 'EZweb'
     assert ua.short_carrier == 'E'
     assert ua.is_docomo() == False
     assert ua.is_ezweb()
     assert ua.is_softbank() == False
     assert ua.is_vodafone() == False
     assert ua.is_jphone() == False
     assert ua.is_willcom() == False
     assert ua.model == model, msg(ua, ua.model, model)
     assert ua.version == version, msg(ua, ua.version, version)
     assert ua.device_id == device_id, msg(ua, ua.device_id, device_id)
     assert ua.server == server, msg(ua, ua.server, server)
     assert ua.comment == comment, msg(ua, ua.comment, comment)
     assert ua.is_xhtml_compliant() == xhtml_compliant
     assert ua.is_wap1() == is_wap1
     assert ua.is_wap2() == is_wap2
     assert ua.is_win() == is_win
     assert ua.display is not None
     assert ua.supports_cookie() == True
Beispiel #3
0
    def inner(useragent,
              version,
              html_version,
              model,
              cache_size,
              is_foma,
              vendor,
              series,
              options=None,
              display=None,
              supports_cookie=False):

        ua = detect({'HTTP_USER_AGENT': useragent})
        assert ua.is_docomo()
        assert ua.is_ezweb() == False
        assert ua.is_softbank() == False
        assert ua.is_vodafone() == False
        assert ua.is_jphone() == False
        assert ua.is_willcom() == False
        assert ua.is_nonmobile() == False, ua

        assert ua.version == version
        assert ua.model == model, (ua, model)
        assert ua.html_version == html_version, msg(ua, ua.html_version,
                                                    html_version)
        assert ua.cache_size == cache_size, (ua, cache_size)
        assert ua.is_foma() == is_foma, (ua, is_foma)
        assert ua.vendor == vendor, (ua, vendor)
        assert ua.series == series, msg(ua, ua.series, series)
        assert ua.display is not None
        if display:
            assert (ua.display.width,
                    ua.display.height) == display, (ua.display.width,
                                                    ua.display.height)
        assert ua.supports_cookie() == supports_cookie

        if options:
            for k, v in list(options.items()):
                if k == 'status':
                    assert ua.status == v, msg(ua, ua.status, v)
                elif k == 'serial_number':
                    assert ua.serialnumber == v, msg(ua, ua.serialnumber, v)
                elif k == 'card_id':
                    assert ua.card_id == v, msg(ua, ua.card_id, v)
                elif k == 'bandwidth':
                    assert ua.bandwidth == v, msg(ua, ua.bandwidth, v)
                elif k == 'comment':
                    assert ua.comment == v, msg(ua, ua.comment, v)
                elif k == 'is_gps':
                    assert ua.is_gps() == v, msg(ua, ua.is_gps(), v)
 def inner(useragent, version, model, device_id, server, xhtml_compliant,
           comment, is_wap1, is_wap2, is_win):
     ua = detect({'HTTP_USER_AGENT': useragent})
     assert ua.carrier == 'EZweb'
     assert ua.short_carrier == 'E'
     assert ua.is_docomo() == False
     assert ua.is_ezweb()
     assert ua.is_softbank() == False
     assert ua.is_vodafone() == False
     assert ua.is_jphone() == False
     assert ua.is_willcom() == False
     assert ua.model == model, msg(ua, ua.model, model)
     assert ua.version == version, msg(ua, ua.version, version)
     assert ua.device_id == device_id, msg(ua, ua.device_id, device_id)
     assert ua.server == server, msg(ua, ua.server, server)
     assert ua.comment == comment, msg(ua, ua.comment, comment)
     assert ua.is_xhtml_compliant() == xhtml_compliant
     assert ua.is_wap1() == is_wap1
     assert ua.is_wap2() == is_wap2
     assert ua.is_win() == is_win
     assert ua.display is not None
     assert ua.supports_cookie() == True
Beispiel #5
0
    def inner(useragent, version, model, packet_compliant,
              serial_number=None, vendor=None, vendor_version=None, java_infos=None):
        ua = detect({'HTTP_USER_AGENT': useragent})

        assert ua.carrier == 'SoftBank'
        assert ua.short_carrier == 'S'

        assert ua.is_docomo() == False
        assert ua.is_ezweb() == False
        assert ua.is_softbank()
        assert ua.is_vodafone()
        assert ua.is_jphone()
        assert ua.is_willcom() == False
        assert ua.is_nonmobile() == False
        assert ua.display is not None

        if serial_number:
            assert ua.serialnumber == serial_number, msg(ua, ua.serialnumber, serial_number)
            assert ua.version == version
            assert ua.model == model, msg(ua, ua.model, model)
            assert ua.packet_compliant == packet_compliant

            assert ua.vendor == vendor, msg(ua, ua.vendor, vendor)
            assert ua.vendor_version == vendor_version, msg(ua, ua.vendor_version, vendor_version)
Beispiel #6
0
    def inner(useragent, version, html_version, model, cache_size,
              is_foma, vendor, series, options=None, display=None, supports_cookie=False):

        ua = detect({'HTTP_USER_AGENT':useragent})
        assert ua.is_docomo()
        assert ua.is_ezweb() == False
        assert ua.is_softbank() == False
        assert ua.is_vodafone() == False
        assert ua.is_jphone() == False
        assert ua.is_willcom() == False
        assert ua.is_nonmobile() == False, ua

        assert ua.version == version
        assert ua.model == model, (ua, model)
        assert ua.html_version == html_version, msg(ua, ua.html_version, html_version)
        assert ua.cache_size == cache_size, (ua, cache_size)
        assert ua.is_foma() == is_foma, (ua, is_foma)
        assert ua.vendor == vendor, (ua, vendor)
        assert ua.series == series, msg(ua, ua.series, series)
        assert ua.display is not None
        if display:
            assert (ua.display.width, ua.display.height) == display, (ua.display.width, ua.display.height)
        assert ua.supports_cookie() == supports_cookie

        if options:
            for k, v in options.items():
                if k == 'status':
                    assert ua.status == v, msg(ua, ua.status, v)
                elif k == 'serial_number':
                    assert ua.serialnumber == v, msg(ua, ua.serialnumber, v)
                elif k == 'card_id':
                    assert ua.card_id == v, msg(ua, ua.card_id, v)
                elif k == 'bandwidth':
                    assert ua.bandwidth == v, msg(ua, ua.bandwidth, v)
                elif k == 'comment':
                    assert ua.comment == v, msg(ua, ua.comment, v)
                elif k == 'is_gps':
                    assert ua.is_gps() == v, msg(ua, ua.is_gps(), v)