Example #1
0
 def test_referenced_as_owner(self):
     """If a group owns another group, it is referenced."""
     make_group('Referenced')
     make_group('Group 1', owners='Referenced')
     make_group('Group 2', owners='Referenced')
     make_group('Group 3', owners='Group 1')
     self.assertEqual(set(['Group 1', 'Group 2']),
                      model.find_referencing_groups('Referenced'))
Example #2
0
 def test_referenced_as_owner(self):
   """If a group owns another group, it is referenced."""
   make_group('Referenced')
   make_group('Group 1', owners='Referenced')
   make_group('Group 2', owners='Referenced')
   make_group('Group 3', owners='Group 1')
   self.assertEqual(
       set(['Group 1', 'Group 2']),
       model.find_referencing_groups('Referenced'))
Example #3
0
    def test_referenced_as_nested_group(self):
        """If group is nested into another group, it's referenced."""
        # Some mix of groups with references, including group to be tested.
        make_group('Referenced')
        make_group('Group 1')
        make_group('Group 2', nested=('Referenced', 'Group 1'))
        make_group('Group 3', nested=('Group 2', ))
        make_group('Group 4', nested=('Referenced', ))

        # Only direct references are returned.
        self.assertEqual(set(['Group 2', 'Group 4']),
                         model.find_referencing_groups('Referenced'))
Example #4
0
  def test_referenced_as_nested_group(self):
    """If group is nested into another group, it's referenced."""
    # Some mix of groups with references, including group to be tested.
    make_group('Referenced')
    make_group('Group 1')
    make_group('Group 2', nested=('Referenced', 'Group 1'))
    make_group('Group 3', nested=('Group 2',))
    make_group('Group 4', nested=('Referenced',))

    # Only direct references are returned.
    self.assertEqual(
        set(['Group 2', 'Group 4']),
        model.find_referencing_groups('Referenced'))
Example #5
0
  def test_not_referenced(self):
    """Existing orphaned groups is not referenced."""
    # Some mix of groups with references.
    make_group('Group 1')
    make_group('Group 2')
    make_group('Group 3', nested=('Group 1', 'Group 2'))
    make_group('Group 4', nested=('Group 3',))

    # And a group that is not referenced by anything.
    make_group('Standalone')

    # Should not be referenced.
    self.assertEqual(set(), model.find_referencing_groups('Standalone'))
Example #6
0
    def test_not_referenced(self):
        """Existing orphaned groups is not referenced."""
        # Some mix of groups with references.
        make_group('Group 1')
        make_group('Group 2')
        make_group('Group 3', nested=('Group 1', 'Group 2'))
        make_group('Group 4', nested=('Group 3', ))

        # And a group that is not referenced by anything.
        make_group('Standalone')

        # Should not be referenced.
        self.assertEqual(set(), model.find_referencing_groups('Standalone'))
Example #7
0
 def test_missing_group(self):
   """Non existent group is not references by anything."""
   self.assertEqual(set(), model.find_referencing_groups('Missing group'))
Example #8
0
 def test_missing_group(self):
     """Non existent group is not references by anything."""
     self.assertEqual(set(), model.find_referencing_groups('Missing group'))