示例#1
0
    def test_name_parent_filter_rename(self):
        flag = Flag(ancestry=['flag_parent'], action='test_flag')
        filter_element = Filter(action="test_filter", ancestry=flag.ancestry)
        flag.filters = [filter_element]

        new_ancestry = ["flag_parent_update"]
        flag.reconstruct_ancestry(new_ancestry)
        new_ancestry.append("test_flag")
        new_ancestry.append("test_filter")
        self.assertListEqual(new_ancestry, flag.filters[0].ancestry)
示例#2
0
    def test_name_parent_multiple_filter_rename(self):
        flag = Flag(ancestry=['flag_parent'], action='test_flag')
        filter_one = Filter(action="test_filter_one", ancestry=flag.ancestry)
        filter_two = Filter(action="test_filter_two", ancestry=flag.ancestry)
        flag.filters = [filter_one, filter_two]

        new_ancestry = ["flag_parent_update"]
        flag.reconstruct_ancestry(new_ancestry)
        new_ancestry.append("test_flag")
        new_ancestry.append("test_filter_one")
        self.assertListEqual(new_ancestry, flag.filters[0].ancestry)

        new_ancestry.remove("test_filter_one")
        new_ancestry.append("test_filter_two")
        self.assertListEqual(new_ancestry, flag.filters[1].ancestry)
示例#3
0
 def test_reconstruct_ancestry_with_filters(self):
     filters = [
         Filter(action='mod1_filter2', args={'arg1': '5.4'}),
         Filter(action='Top Filter')
     ]
     flag = Flag(action='Top Flag',
                 filters=filters,
                 ancestry=['flag_parent'])
     new_ancestry = ['new_parent']
     flag.reconstruct_ancestry(new_ancestry)
     new_ancestry.append('Top Flag')
     self.assertListEqual(flag.ancestry, new_ancestry)
     for filter_element in filters:
         ancestry = list(new_ancestry)
         ancestry.append(filter_element.action)
         self.assertEqual(filter_element.ancestry, ancestry)
示例#4
0
 def test_reconstruct_ancestry_no_filters(self):
     flag = Flag(ancestry=['parent'], action='Top Flag')
     new_ancestry = ['parent_update']
     flag.reconstruct_ancestry(new_ancestry)
     new_ancestry.append('Top Flag')
     self.assertListEqual(flag.ancestry, new_ancestry)
示例#5
0
 def test_name_parent_rename(self):
     flag = Flag(ancestry=['parent'], action='test')
     new_ancestry = ['parent_update']
     flag.reconstruct_ancestry(new_ancestry)
     new_ancestry.append('test')
     self.assertListEqual(new_ancestry, flag.ancestry)