def test_editors_and_admins_with_1_duplicate_admin(self):
        '''Test editors_and_admins() with one user who is admin of two groups.

        Should return a list with just the one user's ID.

        '''
        user = factories.User()
        factories.Organization(user=user)
        factories.Group(user=user)

        assert plugin.editors_and_admins() == [user['id']]
    def test_editors_and_admins_with_1_admin_and_2_editors(self):
        admin = factories.User()
        org = factories.Organization(user=admin)
        editor_1 = factories.User()
        helpers.call_action('organization_member_create',
                            context={'user': admin['name']},
                            id=org['id'], username=editor_1['name'], role='editor')
        editor_2 = factories.User()
        helpers.call_action('organization_member_create',
                            context={'user': admin['name']},
                            id=org['id'], username=editor_2['name'], role='editor')

        assert _equal_unordered(plugin.editors_and_admins(),
                                [admin['id'], editor_1['id'], editor_2['id']])
 def test_editors_and_admins_with_0_editors_or_admins(self):
     '''Should return an empty list when there are no editors or admins.'''
     assert plugin.editors_and_admins() == []