Ejemplo n.º 1
0
 def test_remove_items_by_project(self):
     self._init_test_data_file()
     title = "title"
     project = "project"
     item = Item(title, {Elem.PROJECT : project})
     orgm = Organizem(TEST_DATA_FILE, IS_UNIT_TESTING)
     orgm.add_item(item)
     self.assertTrue(orgm.find_items(Elem.PROJECT, project))
     orgm.remove_items(Elem.PROJECT, project)
     self.assertFalse(orgm.find_items(Elem.PROJECT, project))
Ejemplo n.º 2
0
 def test_remove_items_rgx_by_area(self):
     self._init_test_data_file()
     title = "title"
     area = "area"
     rgx_match = "are*"
     item = Item(title, {Elem.AREA : area})
     orgm = Organizem(TEST_DATA_FILE, IS_UNIT_TESTING)
     orgm.add_item(item)
     self.assertTrue(orgm.find_items(Elem.AREA, rgx_match, use_regex_match=True))
     orgm.remove_items(Elem.AREA, rgx_match, use_regex_match=True)
     self.assertFalse(orgm.find_items(Elem.AREA, rgx_match, use_regex_match=True))
Ejemplo n.º 3
0
 def test_remove_items_rgx_by_title(self):
     self._init_test_data_file()
     title = "title"
     rgx_match = "titl*"
     item = Item(title)
     orgm = Organizem(TEST_DATA_FILE, IS_UNIT_TESTING)
     orgm.add_item(item)
     self.assertTrue(orgm.find_items(Elem.TITLE, rgx_match, use_regex_match=True))
     # NOTE: Now remove the item and check that it's not there any more
     orgm.remove_items(Elem.TITLE, rgx_match, use_regex_match=True)
     self.assertFalse(orgm.find_items(Elem.TITLE, rgx_match, use_regex_match=True))
Ejemplo n.º 4
0
 def test_add_item__find_item_by_title(self):
     self._init_test_data_file()
     title = "title"        
     item = Item(title)        
     orgm = Organizem(TEST_DATA_FILE, IS_UNIT_TESTING)
     orgm.add_item(item)                
     self.assertTrue(orgm.find_items(Elem.TITLE, title))
Ejemplo n.º 5
0
 def test_add_item__find_items_by_area(self):
     self._init_test_data_file()
     title = "title"
     area = "my area"
     item = Item(title, {Elem.AREA : area})
     orgm = Organizem(TEST_DATA_FILE, IS_UNIT_TESTING)
     orgm.add_item(item)                
     self.assertTrue(orgm.find_items(Elem.AREA, area))
Ejemplo n.º 6
0
 def test_add_item__find_items_by_priority(self):
     self._init_test_data_file()
     title = "title"
     priority = "P1"
     item = Item(title, {Elem.PRIORITY : priority})
     orgm = Organizem(TEST_DATA_FILE, IS_UNIT_TESTING)
     orgm.add_item(item)                
     self.assertTrue(orgm.find_items(Elem.PRIORITY, priority))
Ejemplo n.º 7
0
 def test_add_item__find_items_by_actions(self):
     self._init_test_data_file()
     title = "title"
     action1 = 'action 100'
     action1_rgx = 'action 10*'
     actions1 = [action1]
     # TODO FIX ALL THESE Itme() ctor calls
     item1 = Item(title, {Elem.ACTIONS : actions1})
     orgm = Organizem(TEST_DATA_FILE, IS_UNIT_TESTING)
     orgm.add_item(item1)
     self.assertTrue(orgm.find_items(Elem.ACTIONS, action1_rgx, use_regex_match=True))
     action2 = 'action 200'
     actions2 = [action1, action2]
     item2 = Item(title, {Elem.ACTIONS : actions2})
     orgm.add_item(item2)
     self.assertTrue(orgm.find_items(Elem.ACTIONS, action2))
     self.assertTrue(orgm.find_items(Elem.ACTIONS, actions2))
Ejemplo n.º 8
0
 def test_add_item__find_rgx_items_by_project(self):
     self._init_test_data_file()
     title = "title"
     project = "my project"
     rgx_match = "my proj*"
     item = Item(title, {Elem.PROJECT : project})
     orgm = Organizem(TEST_DATA_FILE, IS_UNIT_TESTING)
     orgm.add_item(item)                
     self.assertTrue(orgm.find_items(Elem.PROJECT, rgx_match, use_regex_match=True))
Ejemplo n.º 9
0
 def test_add_item__find_items_by_tags(self):
     self._init_test_data_file()
     title = "title"
     # Test case of single-value passed to find_items() for a 
     #  element that is stored in item as a list (tags)
     tag1 = 'tag 1'
     tags1 = [tag1]
     item1 = Item(title, {Elem.TAGS : tags1})
     orgm = Organizem(TEST_DATA_FILE, IS_UNIT_TESTING)
     orgm.add_item(item1)
     self.assertTrue(orgm.find_items(Elem.TAGS, tag1))
     # Test case of multi-value list passed to find_items() for a 
     #  element that is stored in item as a list (tags)
     tag2 = 'tag 2'
     tags2 = [tag1, tag2]
     item2 = Item(title, {Elem.TAGS : tags2})
     orgm.add_item(item2)
     self.assertTrue(orgm.find_items(Elem.TAGS, tag2))
     self.assertTrue(orgm.find_items(Elem.TAGS, tags2))
Ejemplo n.º 10
0
    def test_remove_items_by_note(self):
        self._init_test_data_file()
        title = "title"
        note = """* Support for reporting on metadata
** all titles (alpha order, due date order)
  ** all projects (alpha order)
    ** all areas (alpha order)
      ** all tags (alpha order)
        ** all actions (grouped by item, item next due date order)
    http://www.snippy.com

    ljalj;
  a             dafs            asdfdsa           wkwjl;qq;q;"""
        item = Item(title, {Elem.NOTE : note})
        orgm = Organizem(TEST_DATA_FILE, IS_UNIT_TESTING)
        orgm.add_item(item)                
        self.assertTrue(orgm.find_items(Elem.NOTE, note))
        orgm.remove_items(Elem.NOTE, note)        
        self.assertFalse(orgm.find_items(Elem.NOTE, note)) 
Ejemplo n.º 11
0
 def test_remove_items_by_tags(self):
     self._init_test_data_file()
     title = "title"
     tag1 = 'tag 1'
     tags1 = [tag1]
     item1 = Item(title, {Elem.TAGS : tags1})
     orgm = Organizem(TEST_DATA_FILE, IS_UNIT_TESTING)
     orgm.add_item(item1)
     self.assertTrue(orgm.find_items(Elem.TAGS, tag1))
     orgm.remove_items(Elem.TAGS, tag1)
     self.assertFalse(orgm.find_items(Elem.TAGS, tag1))
     tag2 = 'tag 2'
     tags2 = [tag1, tag2]
     item2 = Item(title, {Elem.TAGS : tags2})
     orgm.add_item(item2)
     self.assertTrue(orgm.find_items(Elem.TAGS, tag2))
     self.assertTrue(orgm.find_items(Elem.TAGS, tags2))
     orgm.remove_items(Elem.TAGS, tags2)        
     self.assertFalse(orgm.find_items(Elem.TAGS, tags2))
Ejemplo n.º 12
0
 def test_add_item__find_rgx_items_by_actions(self):
     self._init_test_data_file()
     title = "title"
     # Test case of single-value passed to find_items() for a 
     #  element that is stored in item as a list (tags)
     action1 = 'action 1010'
     action1_rgx = 'action 101*'
     actions1 = [action1]
     item1 = Item(title, {Elem.ACTIONS : actions1})
     orgm = Organizem(TEST_DATA_FILE, IS_UNIT_TESTING)
     orgm.add_item(item1)
     self.assertTrue(orgm.find_items(Elem.ACTIONS, action1_rgx, use_regex_match=True))
     # Test case of multi-value list passed to find_items() for a 
     #  element that is stored in item as a list (tags)
     action2 = 'action 1020'
     action2_rgx = 'action 102*'        
     actions2 = [action1, action2]
     item2 = Item(title, {Elem.ACTIONS : actions2})
     orgm.add_item(item2)
     self.assertTrue(orgm.find_items(Elem.ACTIONS, action2_rgx, use_regex_match=True))
Ejemplo n.º 13
0
 def test_remove_items_rgx_by_actions(self):
     self._init_test_data_file()
     title = "title"
     action1 = 'action 110'
     rgx_match = "action 11*"
     actions1 = [action1]
     item1 = Item(title, {Elem.ACTIONS : actions1})
     orgm = Organizem(TEST_DATA_FILE, IS_UNIT_TESTING)
     orgm.add_item(item1)
     self.assertTrue(orgm.find_items(Elem.ACTIONS, action1))
     orgm.remove_items(Elem.ACTIONS, rgx_match, use_regex_match=True)
     self.assertFalse(orgm.find_items(Elem.ACTIONS, action1))
     action2 = 'action 101'
     rgx_match = "action 10*"
     actions2 = [action1, action2]
     item2 = Item(title, {Elem.ACTIONS : actions2})
     orgm.add_item(item2)
     self.assertTrue(orgm.find_items(Elem.ACTIONS, action2))
     self.assertTrue(orgm.find_items(Elem.ACTIONS, actions2))
     orgm.remove_items(Elem.ACTIONS, rgx_match, use_regex_match=True)        
     self.assertFalse(orgm.find_items(Elem.ACTIONS, actions2))