def test_submit_gallery__invalid_path(self): message = "'invalid_image_path' is not a valid image path." subreddit = Subreddit(self.reddit, display_name="name") with pytest.raises(TypeError) as excinfo: subreddit.submit_gallery( "Cool title", images=[{"image_path": "invalid_image_path"}] ) assert str(excinfo.value) == message
def test_submit_gallery__too_long_caption(self): message = "Caption must be 180 characters or less." subreddit = Subreddit(self.reddit, display_name="name") caption = "wayyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy too long caption" with pytest.raises(TypeError) as excinfo: subreddit.submit_gallery( "Cool title", images=[{"image_path": __file__, "caption": caption}] ) assert str(excinfo.value) == message
def test_submit_gallery__missing_path(self): message = "'image_path' is required." subreddit = Subreddit(self.reddit, display_name="name") with pytest.raises(TypeError) as excinfo: subreddit.submit_gallery( "Cool title", images=[{"caption": "caption"}, {"caption": "caption2"}] ) assert str(excinfo.value) == message