def test_load_last_message_ids(self): config = FileStorageConfiguration() config.twitter_storage._dirs = [self._tmpfile] config.twitter_storage._has_single_file = True engine = FileStorageEngine(config) engine.initialise() store = FileTwitterStore(engine) last_direct_message_id, last_status_id = store.load_last_message_ids() self.assertEquals("-1", last_direct_message_id) self.assertEquals("-1", last_status_id)
def test_twitter_storage(self): config = FileStorageConfiguration() config.twitter_storage._dirs = [self._tmpfile] config.twitter_storage._has_single_file = True engine = FileStorageEngine(config) engine.initialise() store = FileTwitterStore(engine) self.assert_twitter_storage(store)
def test_empty(self): config = FileStorageConfiguration() engine = FileStorageEngine(config) engine.initialise() store = FileTwitterStore(engine) if os.path.exists(store._get_storage_path()) is False: os.mkdir(store._get_storage_path()) store.empty() self.assertFalse(os.path.exists(store._get_storage_path()))
def test_twitter_storage(self): config = FileStorageConfiguration() tmpdir = os.path.dirname(__file__) + os.sep + "twitter" tmpfile = tmpdir + os.sep + "twitter.ids" config.twitter_storage._dirs = [tmpfile] config.twitter_storage._has_single_file = True engine = FileStorageEngine(config) engine.initialise() store = FileTwitterStore(engine) self.assert_twitter_storage(store) shutil.rmtree(tmpdir) self.assertFalse(os.path.exists(tmpdir))
def twitter_store(self): return FileTwitterStore(self)
def test_initialise(self): config = FileStorageConfiguration() engine = FileStorageEngine(config) engine.initialise() store = FileTwitterStore(engine) self.assertEqual(store.storage_engine, engine)