def test_select_file_with_two_options(self, authenticated, filter_g, ask): authenticated.return_value = False two_options = [ {"id": 12345, "description": "Gist #1", "raw_url": "URL #1"}, {"id": 67890, "description": "Gist #2", "raw_url": "URL #2"}, ] filter_g.return_value = two_options ask.return_value = "2" gist = Gist(config["user"], config["file"]) self.assertEqual(gist.load_gist_info(), two_options[1])
def test_select_file_with_no_option(self, authenticated, filter_gists): authenticated.return_value = False filter_gists.return_value = list() gist = Gist(config["user"], config["file"]) self.assertFalse(gist.load_gist_info())
def test_select_file_with_one_option(self, authenticated, filter_gists): authenticated.return_value = False one_option = [{"id": 12345, "description": "Gist #1", "raw_url": "URL #1"}] filter_gists.return_value = one_option gist = Gist(config["user"], config["file"]) self.assertEqual(gist.load_gist_info(), one_option[0])