def test_get_base_path(self):
     self.assertEqual('http://127.0.0.1/api/api2',
                      tools.get_base_path('127.0.0.1', 'api/api2'))
     self.assertEqual('http://127.0.0.1/api/api2',
                      tools.get_base_path('127.0.0.1/', 'api/api2'))
     self.assertEqual('http://127.0.0.1/api/api2',
                      tools.get_base_path('http://127.0.0.1', 'api/api2'))
     self.assertEqual('http://127.0.0.1/api/api2',
                      tools.get_base_path('http://127.0.0.1', '/api/api2'))
     self.assertEqual('http://127.0.0.1/api/api2',
                      tools.get_base_path('http://127.0.0.1', '/api/api2/'))
     self.assertEqual('http://127.0.0.1/api/api2',
                      tools.get_base_path('127.0.0.1', '//api/api2/'))
     self.assertEqual('http://127.0.0.1/api/api2',
                      tools.get_base_path('http://127.0.0.1', '/api//api2'))
     self.assertEqual(
         'http://127.0.0.1/api/api2',
         tools.get_base_path('http://127.0.0.1//', '/api//api2'))
Beispiel #2
0
 def __init__(self, raw_data, hub_ip=None, loop=None, websession=None):
     if ATTR_ROOM in raw_data:
         raw_data = raw_data.get(ATTR_ROOM)
     ApiResource.__init__(self, loop, websession,
                          get_base_path(hub_ip, 'api/rooms'), raw_data)
Beispiel #3
0
 def __init__(self, hub_ip, loop, websession=None):
     ApiEntryPoint.__init__(self, loop, websession,
                            get_base_path(hub_ip, URL_ROOMS))
Beispiel #4
0
 def __init__(self, raw_data, hub_ip=None, loop=None, websession=None):
     if ATTR_SCENE in raw_data:
         raw_data = raw_data.get(ATTR_SCENE)
     ApiResource.__init__(
         self, loop, websession, get_base_path(hub_ip, URL_SCENES),
         raw_data)
Beispiel #5
0
 def __init__(self, raw_data, hub_ip, loop, websession=None):
     if ATTR_SCENE_MEMBER in raw_data:
         raw_data = raw_data.get(ATTR_SCENE_MEMBER)
     ApiResource.__init__(self, loop, websession, raw_data)
     self._base_path = get_base_path(hub_ip, URL_SCENE_MEMBERS)
Beispiel #6
0
 def __init__(self, raw_data, hub_ip=None, loop=None, websession=None):
     if ATTR_SHADE in raw_data:
         raw_data = raw_data.get(ATTR_SHADE)
     ApiResource.__init__(self, loop, websession,
                          get_base_path(hub_ip, URL_SHADES), raw_data)
     self._shade_position = Position(raw_data.get(ATTR_TYPE))
Beispiel #7
0
 def __init__(self, hub_ip, loop, websession=None):
     ApiEntryPoint.__init__(self, loop, websession,get_base_path(hub_ip, 'api/userdata'))
Beispiel #8
0
 def __init__(self, hub_ip, loop, websession=None):
     ApiBase.__init__(self, loop, websession)
     self.ip_address = hub_ip
     self.request = AioRequest(loop, websession)
     self._base_path = get_base_path(hub_ip, 'api')
Beispiel #9
0
 def __init__(self, request: AioRequest, base_path):
     self.request = request
     self._base_path = get_base_path(request.hub_ip, base_path)
Beispiel #10
0
 def __init__(self, raw_data, hub_ip, loop, websession=None):
     if ATTR_USER_DATA in raw_data:
         raw_data = raw_data.get(ATTR_USER_DATA)
     ApiResource.__init__(self, loop, websession, raw_data)
     self._base_path = get_base_path(hub_ip, 'api/userdata')