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 update._fetched 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 update._fetched 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_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_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_strike(self): self.reddit.read_only = False update = LiveUpdate( self.reddit, "xyu8kmjvfrww", "cb5fe532-dbee-11e6-9a91-0e6d74fabcc4" ) with self.recorder.use_cassette("TestLiveUpdateContribution_strike"): update.contrib.strike()
def test_remove(self, _): self.reddit.read_only = False update = LiveUpdate( self.reddit, "xyu8kmjvfrww", "5d556760-dbee-11e6-9f46-0e78de675452" ) with self.recorder.use_cassette("TestLiveUpdateContribution_remove"): update.contrib.remove()
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_attributes(self): update = LiveUpdate(self.reddit, "ukaeu1ik4sw5", "7827987a-c998-11e4-a0b9-22000b6a88d2") with self.use_cassette(): assert isinstance(update.author, Redditor) assert update.author == "umbrae" assert update.name == "LiveUpdate_7827987a-c998-11e4-a0b9-22000b6a88d2" assert update.body.startswith("Small change")
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_attributes(self): update = LiveUpdate(self.reddit, 'ukaeu1ik4sw5', '7827987a-c998-11e4-a0b9-22000b6a88d2') with self.recorder.use_cassette('TestLiveUpdate_test_attributes'): assert isinstance(update.author, Redditor) assert update.author == 'umbrae' assert update.name == ( 'LiveUpdate_7827987a-c998-11e4-a0b9-22000b6a88d2') assert update.body.startswith('Small change')
def test_setattr(self): data = {'id': 'dummy_update_id', 'author': 'dummy_author'} update = LiveUpdate(self.reddit, _data=data) assert isinstance(update.author, Redditor)
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)
def test_setattr(self): data = {"id": "dummy_update_id", "author": "dummy_author"} update = LiveUpdate(self.reddit, _data=data) assert isinstance(update.author, Redditor)