def test_contrib(self): thread_id = "dummy_thread_id" update_id = "dummy_update_id" update = LiveUpdate(self.reddit, thread_id, update_id) assert isinstance(update.contrib, LiveUpdateContribution) data = {"id": "dummy_update_id", "author": "dummy_author"} update = LiveUpdate(self.reddit, _data=data) assert isinstance(update.contrib, LiveUpdateContribution)
def test_thread(self): thread_id = "dummy_thread_id" update_id = "dummy_update_id" update = LiveUpdate(self.reddit, thread_id=thread_id, update_id=update_id) assert isinstance(update.thread, LiveThread) assert update.thread.id == thread_id
def test_construct_failure(self): message = "Either `thread_id` and `update_id`, or `_data` must be provided." thread_id = "dummy_thread_id" update_id = "dummy_update_id" with pytest.raises(TypeError) as excinfo: LiveUpdate(self.reddit) assert str(excinfo.value) == message with pytest.raises(TypeError) as excinfo: LiveUpdate(self.reddit, thread_id=thread_id) assert str(excinfo.value) == message with pytest.raises(TypeError) as excinfo: LiveUpdate(self.reddit, update_id=update_id) assert str(excinfo.value) == message
def test_construct_success(self): thread_id = "dummy_thread_id" update_id = "dummy_update_id" data = {"id": update_id} update = LiveUpdate(self.reddit, thread_id=thread_id, update_id=update_id) assert isinstance(update, LiveUpdate) assert update.id == update_id assert isinstance(update.thread, LiveThread) assert update.thread.id == thread_id update = LiveUpdate(self.reddit, thread_id, update_id) assert isinstance(update, LiveUpdate) assert update.id == update_id assert isinstance(update.thread, LiveThread) assert update.thread.id == thread_id update = LiveUpdate(self.reddit, _data=data) assert isinstance(update, LiveUpdate) assert update.id == update_id assert update._fetched
def test_setattr(self): data = {"id": "dummy_update_id", "author": "dummy_author"} update = LiveUpdate(self.reddit, _data=data) assert isinstance(update.author, Redditor)
async def test_strike(self): self.reddit.read_only = False update = LiveUpdate(self.reddit, "1595195m6j9zw", "3e95636e-bf2c-11ea-9488-0e29bbfe5f37") with self.use_cassette(): await update.contrib.strike()
async def test_remove(self, _): self.reddit.read_only = False update = LiveUpdate(self.reddit, "1595195m6j9zw", "ec5ead40-bf2a-11ea-a3be-0e0d584e0b0b") with self.use_cassette(): await update.contrib.remove()