def test_override(self): """Test that a command line argument overrides the configured value.""" self.assertEqual(True, parse_arguments()[1].open_urls)
def test_default_and_non_default(self): """Test that adding the default filename and another filename gets both included.""" self.assertEqual(["todo.txt", "other.txt"], parse_arguments()[1].file)
def test_one_context(self): """Test that the argument parser returns the context if the user passes one.""" self.assertEqual({"home"}, parse_arguments()[1].contexts)
def test_style(self): """Test that the argument parser returns the default style if the user doesn't pass one.""" self.assertEqual(None, parse_arguments()[1].style)
def test_long_filename_argument(self): """Test that the argument parser accepts a filename.""" self.assertEqual(["my_other_todo.txt"], parse_arguments()[1].file)
def test_always(self): """Test that the value can be set to always.""" self.assertEqual("always", parse_arguments()[1].reference)
def test_filters(self): """Test that the argument parser returns no filters if the user doesn't pass one.""" self.assertEqual(set(), parse_arguments()[1].contexts) self.assertEqual(set(), parse_arguments()[1].projects) self.assertEqual(set(), parse_arguments()[1].excluded_contexts) self.assertEqual(set(), parse_arguments()[1].excluded_projects)
def test_contexts_and_projects(self): """Test that the argument parser returns the contexts and the projects, even when mixed.""" self.assertEqual({"home", "weekend"}, parse_arguments()[1].contexts) self.assertEqual({"DogHouse", "PaintHouse"}, parse_arguments()[1].projects)
def test_project_after_excluded(self): """Test project after excluded context.""" namespace = parse_arguments()[1] self.assertEqual({"home"}, namespace.contexts) self.assertEqual({"work"}, namespace.excluded_contexts) self.assertEqual({"PaintHouse"}, namespace.projects)
def test_multiple_projects(self): """Test that the argument parser returns the projects if the user passes multiple projects.""" self.assertEqual({"DogHouse", "PaintHouse"}, parse_arguments()[1].projects)
def test_exclude_project(self): """Test that projects can be excluded.""" self.assertEqual({"DogHouse"}, parse_arguments()[1].excluded_projects)
def test_one_project(self): """Test that the argument parser returns the project if the user passes one.""" self.assertEqual({"DogHouse"}, parse_arguments()[1].projects)
def test_exclude_context(self): """Test that contexts can be excluded.""" self.assertEqual({"home"}, parse_arguments()[1].excluded_contexts)
def test_skip_config(self, mock_file_open): """Test that the config file is not read if the user doesn't want to.""" parse_arguments() self.assertEqual([], mock_file_open.call_args_list)
def test_default(self): """Test that the default value for the reference value is multiple.""" self.assertEqual("multiple", parse_arguments()[1].reference)
def test_default_number(self): """Test that the argument parser has a default number of actions to return.""" self.assertEqual(1, parse_arguments()[1].number)
def test_multiple(self): """Test that the value can be set to multiple, even though it's the default.""" self.assertEqual("multiple", parse_arguments()[1].reference)
def test_number(self): """Test that a number of actions to be shown can be passed.""" self.assertEqual(3, parse_arguments()[1].number)
def test_never(self): """Test that the value can be set to never.""" self.assertEqual("never", parse_arguments()[1].reference)
def test_all_actions(self): """Test that --all option also sets the number of actions to show to a very big number.""" self.assertEqual(sys.maxsize, parse_arguments()[1].number)
def test_filename(self): """Test that the argument parser returns the default filename if the user doesn't pass one.""" self.assertEqual(["~/todo.txt"], parse_arguments()[1].file)
def test_default(self): """Test that the default value for due date is None.""" self.assertEqual(None, parse_arguments()[1].due)
def test_home_folder_argument(self): """Test that the argument parser accepts a filename with a tilde.""" self.assertEqual(["~/my_todo.txt"], parse_arguments()[1].file)
def test_no_due_date(self): """Test that the due date is the max date if the user doesn't specify a date.""" self.assertEqual(datetime.date.max, parse_arguments()[1].due)
def test_add_default_filename(self): """Test that adding the default filename doesn't get it included twice.""" self.assertEqual(["~/todo.txt"], parse_arguments()[1].file)
def test_due_date(self): """Test that a valid value for due date can be parsed.""" self.assertEqual(datetime.date(2018, 1, 1), parse_arguments()[1].due)
def test_add_filename_twice(self): """Test that adding the same filename twice includes it only once.""" self.assertEqual(["other.txt"], parse_arguments()[1].file)
def test_relative_due_date(self): """Test that a valid relative value for due date can be parsed.""" self.assertEqual(datetime.date.today(), parse_arguments()[1].due)
def test_multiple_contexts(self): """Test that the argument parser returns all contexts if the user passes multiple contexts.""" self.assertEqual({"home", "work"}, parse_arguments()[1].contexts)
def test_open_urls(self): """Test that the configured value changes the open-urls argument.""" self.assertEqual(True, parse_arguments()[1].open_urls)