示例#1
0
    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)
示例#2
0
    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)
示例#3
0
    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()))
示例#4
0
    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))
示例#5
0
 def twitter_store(self):
     return FileTwitterStore(self)
示例#6
0
 def test_initialise(self):
     config = FileStorageConfiguration()
     engine = FileStorageEngine(config)
     engine.initialise()
     store = FileTwitterStore(engine)
     self.assertEqual(store.storage_engine, engine)