예제 #1
0
 def test_override(self):
     """Test that a command line argument overrides the configured value."""
     self.assertEqual(True, parse_arguments()[1].open_urls)
예제 #2
0
 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)
예제 #3
0
 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)
예제 #4
0
 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)
예제 #5
0
 def test_long_filename_argument(self):
     """Test that the argument parser accepts a filename."""
     self.assertEqual(["my_other_todo.txt"], parse_arguments()[1].file)
예제 #6
0
 def test_always(self):
     """Test that the value can be set to always."""
     self.assertEqual("always", parse_arguments()[1].reference)
예제 #7
0
 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)
예제 #8
0
 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)
예제 #9
0
 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)
예제 #10
0
 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)
예제 #11
0
 def test_exclude_project(self):
     """Test that projects can be excluded."""
     self.assertEqual({"DogHouse"}, parse_arguments()[1].excluded_projects)
예제 #12
0
 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)
예제 #13
0
 def test_exclude_context(self):
     """Test that contexts can be excluded."""
     self.assertEqual({"home"}, parse_arguments()[1].excluded_contexts)
예제 #14
0
 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)
예제 #15
0
 def test_default(self):
     """Test that the default value for the reference value is multiple."""
     self.assertEqual("multiple", parse_arguments()[1].reference)
예제 #16
0
 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)
예제 #17
0
 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)
예제 #18
0
 def test_number(self):
     """Test that a number of actions to be shown can be passed."""
     self.assertEqual(3, parse_arguments()[1].number)
예제 #19
0
 def test_never(self):
     """Test that the value can be set to never."""
     self.assertEqual("never", parse_arguments()[1].reference)
예제 #20
0
 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)
예제 #21
0
 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)
예제 #22
0
 def test_default(self):
     """Test that the default value for due date is None."""
     self.assertEqual(None, parse_arguments()[1].due)
예제 #23
0
 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)
예제 #24
0
 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)
예제 #25
0
 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)
예제 #26
0
 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)
예제 #27
0
 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)
예제 #28
0
 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)
예제 #29
0
 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)
예제 #30
0
 def test_open_urls(self):
     """Test that the configured value changes the open-urls argument."""
     self.assertEqual(True, parse_arguments()[1].open_urls)