Esempio n. 1
0
    def test_load_method(self, mock):
        """Test PyArlo ArloMediaLibrary.load() method."""
        from pyarlo import PyArlo
        from pyarlo.media import ArloMediaLibrary

        mock.post(LOGIN_ENDPOINT,
                  text=load_fixture('pyarlo_authentication.json'))
        mock.get(DEVICES_ENDPOINT, text=load_fixture('pyarlo_devices.json'))
        mock.post(LIBRARY_ENDPOINT, text=load_fixture('pyarlo_videos.json'))

        arlo = PyArlo(USERNAME, PASSWORD, preload=False)
        library = ArloMediaLibrary(arlo, preload=False)
        camera = arlo.lookup_camera_by_id('48B14C1299999')
        videos = library.load(days=1, limit=3, only_cameras=camera)
        self.assertEqual(len(videos), 2)
Esempio n. 2
0
    def test_general_attributes(self, mock):
        """Test PyArlo without preloading videos."""
        from pyarlo import PyArlo
        from pyarlo.camera import ArloCamera

        mock.post(LOGIN_ENDPOINT,
                  text=load_fixture('pyarlo_authentication.json'))
        mock.get(DEVICES_ENDPOINT, text=load_fixture('pyarlo_devices.json'))
        mock.post(LIBRARY_ENDPOINT, text=load_fixture('pyarlo_videos.json'))
        mock.get(RESET_ENDPOINT, json={'success': True})

        arlo = PyArlo(USERNAME, PASSWORD, days=1)

        self.assertEqual(arlo.__repr__(), '<PyArlo: 999-123456>')
        self.assertIsInstance(arlo.lookup_camera_by_id('48B14CAAAAAAA'),
                              ArloCamera)
        self.assertRaises(IndexError, arlo.lookup_camera_by_id, 'FAKEID')
        self.assertTrue(arlo.is_connected)
        self.assertTrue(arlo.unseen_videos_reset)
        self.assertIsNone(arlo.update())