class TestUser(TestCase): @skipIf(not USERNAME or not PASSWORD, WARN) def test_returning_user_online(self): self.user = Ghost().bootstrap().init() self._assert_ok() def test_returning_user_offline(self): self.user = Ghost(offline=True).bootstrap().init() self._assert_ok() @skipIf(not USERNAME or not PASSWORD, WARN) def test_new_user_online(self): self.user = Ghost().init() self._assert_ok() def _assert_ok(self): self.assertIsInstance(self.user, User) self.assertTrue(all(list(map(isdir, self.user.folders)))) self.assertIsInstance(self.user.engine, Engine) def tearDown(self): self.user.clear() self.user.logout() def test_new_user_offline(self): self.user = Ghost(offline=True, username='******', password='******') self.assertRaises(UserError, lambda: self.user.init())
def test_archiver(): user = Ghost(offline=True).bootstrap().flush().init() archive(user.db, OVERNIGHT_PROCESSED) assert len(user.db.query(Checkin).all()) == 2 assert len(user.db.query(Checkpoint).all()) == 2 assert user.db.query(Client.id).scalar() == 59017 assert user.db.query(Order.id).scalar() == 1402120029 user.clear()
def test_download_one_day(self): self.user = Ghost().bootstrap().flush().init() self._check()
def test_load_one_day_from_cache(self): self.user = Ghost(offline=True).bootstrap().init() self._check()
def test_new_user_offline(self): self.user = Ghost(offline=True, username='******', password='******') self.assertRaises(UserError, lambda: self.user.init())
def test_new_user_online(self): self.user = Ghost().init() self._assert_ok()
def test_returning_user_offline(self): self.user = Ghost(offline=True).bootstrap().init() self._assert_ok()