# Path: uamobile/ezweb.py
# class EZwebUserAgent(UserAgent):
#     carrier = 'EZweb'
#     short_carrier = 'E'
# 
#     def get_flash_version(self):
#         """
#         returns Flash Lite version.
#         """
#         from uamobile.data.flash.ezweb import DATA
#         try:
#             return DATA[self.model]
#         except KeyError:
#             return '2.0'
#     flash_version = property(get_flash_version)
# 
#     def supports_cookie(self):
#         return True
# 
#     def make_display(self):
#         """
#         create a Display object.
#         """
#         env = self.environ
#         try:
#             width, height = map(int, env['HTTP_X_UP_DEVCAP_SCREENPIXELS'].split(',', 1))
#         except (KeyError, ValueError), e:
#             width = None
#             height = None
# 
#         try:
#             color = env['HTTP_X_UP_DEVCAP_ISCOLOR'] == '1'
#         except KeyError:
#             color = False
# 
#         try:
#             sd = env['HTTP_X_UP_DEVCAP_SCREENDEPTH'].split(',', 1)
#             depth = sd[0] and (2 ** int(sd[0])) or 0
#         except (KeyError, ValueError):
#             depth = None
# 
#         return Display(width=width, height=height, color=color, depth=depth)
# 
#     def is_ezweb(self):
#         return True
# 
#     def get_serialnumber(self):
#         """
#         return the EZweb subscriber ID.
#         if no subscriber ID is available, returns None.
#         """
#         try:
#             return self.environ['HTTP_X_UP_SUBNO']
#         except KeyError:
#             return None
#     serialnumber = property(get_serialnumber)
# 
#     def is_xhtml_compliant(self):
#         """
#         returns whether it's XHTML compliant or not.
#         """
#         return self.xhtml_compliant
# 
#     def is_win(self):
#         """
#         returns whether the agent is CDMA 1X WIN or not.
#         """
#         return self.device_id[2:3] == '3'
# 
#     def is_wap1(self):
#         return not self.is_wap2()
# 
#     def is_wap2(self):
#         return self.xhtml_compliant
# 
# Path: uamobile/factory/ezweb.py
# class EZwebUserAgentFactory(AbstractUserAgentFactory):
#     device_class = EZwebUserAgent
#     parser       = CachingEZwebUserAgentParser()


from tests import msg
from uamobile import *
from uamobile.ezweb import EZwebUserAgent
from uamobile.factory.ezweb import EZwebUserAgentFactory
# -*- coding: utf-8 -*-

def test_detect_fast():
    assert detect_fast('KDDI-HI36 UP.Browser/6.2.0.10.4 (GUI) MMP/2.0') == 'ezweb'

def test_netfront_nonmobile_mode():
    ua = detect({'HTTP_USER_AGENT':'KDDI-TS3A UP.Browser/6.2.0.11.2.1 (GUI) MMP/2.0, Mozilla/4.08 (MobilePhone; NMCS/3.3) NetFront/3.3'})
    assert ua.is_ezweb()
    assert ua.model == 'TS3A'
    assert ua.version == '6.2.0.11.2.1 (GUI)'

# Path: uamobile/ezweb.py
# class EZwebUserAgent(UserAgent):
#     carrier = 'EZweb'
#     short_carrier = 'E'
# 
#     def get_flash_version(self):
#         """
#         returns Flash Lite version.
#         """
#         from uamobile.data.flash.ezweb import DATA
#         try:
#             return DATA[self.model]
#         except KeyError:
#             return '2.0'
#     flash_version = property(get_flash_version)
# 
#     def supports_cookie(self):
#         return True
# 
#     def make_display(self):
#         """
#         create a Display object.
#         """
#         env = self.environ
#         try:
#             width, height = map(int, env['HTTP_X_UP_DEVCAP_SCREENPIXELS'].split(',', 1))
#         except (KeyError, ValueError), e:
#             width = None
#             height = None
# 
#         try:
#             color = env['HTTP_X_UP_DEVCAP_ISCOLOR'] == '1'
#         except KeyError:
#             color = False
# 
#         try:
#             sd = env['HTTP_X_UP_DEVCAP_SCREENDEPTH'].split(',', 1)
#             depth = sd[0] and (2 ** int(sd[0])) or 0
#         except (KeyError, ValueError):
#             depth = None
# 
#         return Display(width=width, height=height, color=color, depth=depth)
# 
#     def is_ezweb(self):
#         return True
# 
#     def get_serialnumber(self):
#         """
#         return the EZweb subscriber ID.
#         if no subscriber ID is available, returns None.
#         """
#         try:
#             return self.environ['HTTP_X_UP_SUBNO']
#         except KeyError:
#             return None
#     serialnumber = property(get_serialnumber)
# 
#     def is_xhtml_compliant(self):
#         """
#         returns whether it's XHTML compliant or not.
#         """
#         return self.xhtml_compliant
# 
#     def is_win(self):
#         """
#         returns whether the agent is CDMA 1X WIN or not.
#         """
#         return self.device_id[2:3] == '3'
# 
#     def is_wap1(self):
#         return not self.is_wap2()
# 
#     def is_wap2(self):
#         return self.xhtml_compliant
# 
# Path: uamobile/factory/ezweb.py
# class EZwebUserAgentFactory(AbstractUserAgentFactory):
#     device_class = EZwebUserAgent
#     parser       = CachingEZwebUserAgentParser()


# Path: tests/test_ezweb.py
from tests import msg
from uamobile import *
from uamobile.ezweb import EZwebUserAgent
from uamobile.factory.ezweb import EZwebUserAgentFactory

# -*- coding: utf-8 -*-

def test_detect_fast():
    assert detect_fast('KDDI-HI36 UP.Browser/6.2.0.10.4 (GUI) MMP/2.0') == 'ezweb'

def test_netfront_nonmobile_mode():
    ua = detect({'HTTP_USER_AGENT':'KDDI-TS3A UP.Browser/6.2.0.11.2.1 (GUI) MMP/2.0, Mozilla/4.08 (MobilePhone; NMCS/3.3) NetFront/3.3'})
    assert ua.is_ezweb()
    assert ua.model == 'TS3A'
    assert ua.version == '6.2.0.11.2.1 (GUI)'

    assert ua.server == 'MMP/2.0'