Update unifi.py to support sites (#2434)

* Update unifi.py

Add support for a site that is not the default within the Unifi Controller.

i.e. A controller with multiple sites:

 - Home
 - Friends
 - Parents (default)

Supplying the identifier for 'Home' now means that the devices tracked will be associated with 'Home'.

* Update test_unifi.py

Fix test modules as well.
This commit is contained in:
Jordan Keith 2016-07-05 01:20:00 +10:00 committed by Paulus Schoutsen
parent 2cdef7fb2f
commit 83a72ab4dc
2 changed files with 6 additions and 3 deletions

View file

@ -24,7 +24,7 @@ class TestUnifiScanner(unittest.TestCase):
result = unifi.get_scanner(None, config)
self.assertEqual(unifi.UnifiScanner.return_value, result)
mock_ctrl.assert_called_once_with('localhost', 'foo', 'password',
8443, 'v4')
8443, 'v4', 'default')
mock_scanner.assert_called_once_with(mock_ctrl.return_value)
@mock.patch('homeassistant.components.device_tracker.unifi.UnifiScanner')
@ -37,12 +37,13 @@ class TestUnifiScanner(unittest.TestCase):
CONF_PASSWORD: 'password',
CONF_HOST: 'myhost',
'port': 123,
'site_id': 'abcdef01',
}
}
result = unifi.get_scanner(None, config)
self.assertEqual(unifi.UnifiScanner.return_value, result)
mock_ctrl.assert_called_once_with('myhost', 'foo', 'password',
123, 'v4')
123, 'v4', 'abcdef01')
mock_scanner.assert_called_once_with(mock_ctrl.return_value)
@mock.patch('homeassistant.components.device_tracker.unifi.UnifiScanner')