コード例 #1
0
    def test_get_user_group(self):
        project = ProjectF.create()
        grouping = GroupingFactory.create(**{'project': project})
        group = UserGroupF(**{'project': project})

        html = get_user_group(group, grouping)
        self.assertEqual(
            html,
            '<li>'
            '<button type="button" name="%s" class="btn btn-default '
            'pull-right grant-single" data-toggle="button" ><span '
            'class="text-success">Grant access</span></button>'
            '<strong>%s</strong><p>%s</p>'
            '</li>' % (group.id, group.name, group.description)
        )

        GroupingUserGroupFactory.create(**{
            'usergroup': group,
            'grouping': grouping
        })

        html = get_user_group(group, grouping)
        self.assertEqual(
            html,
            '<li>'
            '<button type="button" name="%s" class="btn btn-default '
            'pull-right active grant-single" data-toggle="button" >'
            '<span class="text-danger">Revoke access</span></button>'
            '<strong>%s</strong><p>%s</p>'
            '</li>' % (group.id, group.name, group.description)
        )

        project.isprivate = False
        project.save()
        grouping.isprivate = False
        grouping.save()

        html = get_user_group(group, grouping)
        self.assertEqual(
            html,
            '<li>'
            '<button type="button" name="%s" class="btn btn-default '
            'pull-right active grant-single" data-toggle="button" '
            'disabled="disabled">'
            '<span class="text-danger">Revoke access</span></button>'
            '<strong>%s</strong><p>%s</p>'
            '</li>' % (group.id, group.name, group.description)
        )
コード例 #2
0
ファイル: test_model.py プロジェクト: tainita01/geokey
    def test_moderator(self):
        user = UserF.create()

        view = GroupingFactory.create()
        group = UserGroupF.create(
            add_users=[user],
            **{'project': view.project, 'can_moderate': True}
        )
        GroupingUserGroupFactory.create(
            **{'grouping': view, 'usergroup': group,
                'can_view': True, 'can_read': True}
        )

        self.assertTrue(view.can_view(user))
        self.assertTrue(view.can_read(user))
        self.assertTrue(view.can_moderate(user))
コード例 #3
0
    def test_get_user_group(self):
        project = ProjectF.create()
        grouping = GroupingFactory.create(**{'project': project})
        group = UserGroupF(**{'project': project})

        html = get_user_group(group, grouping)
        self.assertEqual(
            html, '<li>'
            '<button type="button" name="%s" class="btn btn-default '
            'pull-right grant-single" data-toggle="button" ><span '
            'class="text-success">Grant access</span></button>'
            '<strong>%s</strong><p>%s</p>'
            '</li>' % (group.id, group.name, group.description))

        GroupingUserGroupFactory.create(**{
            'usergroup': group,
            'grouping': grouping
        })

        html = get_user_group(group, grouping)
        self.assertEqual(
            html, '<li>'
            '<button type="button" name="%s" class="btn btn-default '
            'pull-right active grant-single" data-toggle="button" >'
            '<span class="text-danger">Revoke access</span></button>'
            '<strong>%s</strong><p>%s</p>'
            '</li>' % (group.id, group.name, group.description))

        project.isprivate = False
        project.save()
        grouping.isprivate = False
        grouping.save()

        html = get_user_group(group, grouping)
        self.assertEqual(
            html, '<li>'
            '<button type="button" name="%s" class="btn btn-default '
            'pull-right active grant-single" data-toggle="button" '
            'disabled="disabled">'
            '<span class="text-danger">Revoke access</span></button>'
            '<strong>%s</strong><p>%s</p>'
            '</li>' % (group.id, group.name, group.description))
コード例 #4
0
    def add_viewers(self, create, extracted, **kwargs):
        if not create:
            return

        if extracted:
            from geokey.users.tests.model_factories import (
                UserGroupF, GroupingUserGroupFactory)
            group = UserGroupF(add_users=extracted,
                               **{
                                   'project': self.project,
                                   'can_contribute': False
                               })

            GroupingUserGroupFactory(**{'grouping': self, 'usergroup': group})
コード例 #5
0
    def setUp(self):
        self.moderator_view = UserF.create()
        self.moderator = UserF.create()
        self.contributor_view = UserF.create()
        self.contributor = UserF.create()
        self.viewer_view = UserF.create()
        self.viewer = UserF.create()
        self.some_dude = UserF.create()

        self.project = ProjectF.create(**{
            'isprivate': False,
            'everyone_contributes': 'false'
        })

        self.view = GroupingFactory(**{
            'project': self.project,
            'isprivate': False
        })
        self.moderators_view = UserGroupF(add_users=[self.moderator_view],
                                          **{
                                              'project': self.project,
                                              'can_moderate': True
                                          })
        self.contributors_view = UserGroupF(add_users=[self.contributor_view],
                                            **{
                                                'project': self.project,
                                                'can_contribute': True
                                            })
        self.viewers_view = UserGroupF(add_users=[self.viewer_view],
                                       **{
                                           'project': self.project,
                                           'can_contribute': False,
                                           'can_moderate': False
                                       })

        GroupingUserGroupFactory.create(**{
            'grouping': self.view,
            'usergroup': self.moderators_view
        })
        GroupingUserGroupFactory.create(**{
            'grouping': self.view,
            'usergroup': self.contributors_view
        })
        GroupingUserGroupFactory.create(**{
            'grouping': self.view,
            'usergroup': self.viewers_view
        })

        self.moderators = UserGroupF(add_users=[self.moderator],
                                     **{
                                         'project': self.project,
                                         'can_moderate': True
                                     })
        self.contributors = UserGroupF(add_users=[self.contributor],
                                       **{
                                           'project': self.project,
                                           'can_contribute': True
                                       })
        self.viewers = UserGroupF(add_users=[self.viewer],
                                  **{
                                      'project': self.project,
                                      'can_contribute': False,
                                      'can_moderate': False
                                  })
コード例 #6
0
ファイル: test_manager.py プロジェクト: tainita01/geokey
    def setUp(self):
        self.admin = UserF.create()
        self.moderator_view = UserF.create()
        self.moderator = UserF.create()
        self.contributor_view = UserF.create()
        self.contributor = UserF.create()
        self.viewer_view = UserF.create()
        self.viewer = UserF.create()
        self.some_dude = UserF.create()

        self.private_project = ProjectF.create(
            add_admins=[self.admin],
            **{
                'name': 'Private',
                'isprivate': True,
                'everyone_contributes': 'false'
            })

        self.private_view = GroupingFactory(
            **{'project': self.private_project, 'isprivate': True}
        )
        self.private_moderators_view = UserGroupF(
            add_users=[self.moderator_view],
            **{
                'project': self.private_project,
                'can_moderate': True
            })
        self.private_contributors_view = UserGroupF(
            add_users=[self.contributor_view],
            **{
                'project': self.private_project,
                'can_contribute': True
            })
        self.private_viewers_view = UserGroupF(
            add_users=[self.viewer_view],
            **{
                'project': self.private_project,
                'can_contribute': False,
                'can_moderate': False
            })

        GroupingUserGroupFactory.create(**{
            'grouping': self.private_view,
            'usergroup': self.private_moderators_view}
        )
        GroupingUserGroupFactory.create(**{
            'grouping': self.private_view,
            'usergroup': self.private_contributors_view
        })
        GroupingUserGroupFactory.create(**{
            'grouping': self.private_view,
            'usergroup': self.private_viewers_view
        })

        self.private_moderators = UserGroupF(
            add_users=[self.moderator],
            **{
                'project': self.private_project,
                'can_moderate': True
            })
        self.private_contributors = UserGroupF(
            add_users=[self.contributor],
            **{
                'project': self.private_project,
                'can_contribute': True
            })
        self.private_viewers = UserGroupF(
            add_users=[self.viewer],
            **{
                'project': self.private_project,
                'can_contribute': False,
                'can_moderate': False
            })

        self.private_publicview_project = ProjectF.create(
            add_admins=[self.admin],
            **{
                'name': 'Private with public view',
                'isprivate': True,
                'everyone_contributes': 'false'
            })

        self.private_publicview_view = GroupingFactory(
            **{'project': self.private_publicview_project, 'isprivate': False}
        )
        self.private_publicview_moderators_view = UserGroupF(
            add_users=[self.moderator_view],
            **{
                'project': self.private_publicview_project,
                'can_moderate': True
            })
        self.private_publicview_contributors_view = UserGroupF(
            add_users=[self.contributor_view],
            **{
                'project': self.private_publicview_project,
                'can_contribute': True
            })
        self.private_publicview_viewers_view = UserGroupF(
            add_users=[self.viewer_view],
            **{
                'project': self.private_publicview_project,
                'can_contribute': False,
                'can_moderate': False
            })

        GroupingUserGroupFactory.create(**{
            'grouping': self.private_publicview_view,
            'usergroup': self.private_publicview_moderators_view
        })
        GroupingUserGroupFactory.create(**{
            'grouping': self.private_publicview_view,
            'usergroup': self.private_publicview_contributors_view
        })
        GroupingUserGroupFactory.create(**{
            'grouping': self.private_publicview_view,
            'usergroup': self.private_publicview_viewers_view
        })

        self.private_publicview_moderators = UserGroupF(
            add_users=[self.moderator],
            **{
                'project': self.private_publicview_project,
                'can_moderate': True
            })
        self.private_publicview_contributors = UserGroupF(
            add_users=[self.contributor],
            **{
                'project': self.private_publicview_project,
                'can_contribute': True
            })
        self.private_publicview_viewers = UserGroupF(
            add_users=[self.viewer],
            **{
                'project': self.private_publicview_project,
                'can_contribute': False,
                'can_moderate': False
            })

        self.private_publicviews_project = ProjectF.create(
            add_admins=[self.admin],
            **{
                'name': 'Private with public views',
                'isprivate': True,
                'everyone_contributes': 'false'
            })

        self.private_publicviews_view = GroupingFactory(
            **{'project': self.private_publicviews_project, 'isprivate': False}
        )
        self.private_publicviews_moderators_view = UserGroupF(
            add_users=[self.moderator_view],
            **{
                'project': self.private_publicviews_project,
                'can_moderate': True
            })
        self.private_publicviews_contributors_view = UserGroupF(
            add_users=[self.contributor_view],
            **{
                'project': self.private_publicviews_project,
                'can_contribute': True
            })
        self.private_publicviews_viewers_view = UserGroupF(
            add_users=[self.viewer_view],
            **{
                'project': self.private_publicviews_project,
                'can_contribute': False,
                'can_moderate': False
            })

        GroupingUserGroupFactory.create(**{
            'grouping': self.private_publicviews_view,
            'usergroup': self.private_publicviews_moderators_view
        })
        GroupingUserGroupFactory.create(**{
            'grouping': self.private_publicviews_view,
            'usergroup': self.private_publicviews_contributors_view
        })
        GroupingUserGroupFactory.create(**{
            'grouping': self.private_publicviews_view,
            'usergroup': self.private_publicviews_viewers_view
        })

        self.private_publicviews_moderators = UserGroupF(
            add_users=[self.moderator],
            **{
                'project': self.private_publicviews_project,
                'can_moderate': True
            })
        self.private_publicviews_contributors = UserGroupF(
            add_users=[self.contributor],
            **{
                'project': self.private_publicviews_project,
                'can_contribute': True
            })
        self.private_publicviews_viewers = UserGroupF(
            add_users=[self.viewer],
            **{
                'project': self.private_publicviews_project,
                'can_contribute': False,
                'can_moderate': False
            })

        self.public_project = ProjectF.create(
            add_admins=[self.admin],
            **{
                'name': 'Public',
                'isprivate': False,
                'everyone_contributes': 'false'
            })

        self.public_view = GroupingFactory(
            **{'project': self.public_project, 'isprivate': True}
        )
        self.public_moderators_view = UserGroupF(
            add_users=[self.moderator_view],
            **{
                'project': self.public_project,
                'can_moderate': True
            })
        self.public_contributors_view = UserGroupF(
            add_users=[self.contributor_view],
            **{
                'project': self.public_project,
                'can_contribute': True
            })
        self.public_viewers_view = UserGroupF(
            add_users=[self.viewer_view],
            **{
                'project': self.public_project,
                'can_contribute': False,
                'can_moderate': False
            })

        GroupingUserGroupFactory.create(**{
            'grouping': self.public_view,
            'usergroup': self.public_moderators_view
        })
        GroupingUserGroupFactory.create(**{
            'grouping': self.public_view,
            'usergroup': self.public_contributors_view
        })
        GroupingUserGroupFactory.create(**{
            'grouping': self.public_view,
            'usergroup': self.public_viewers_view
        })

        self.public_moderators = UserGroupF(
            add_users=[self.moderator],
            **{
                'project': self.public_project,
                'can_moderate': True
            })
        self.public_contributors = UserGroupF(
            add_users=[self.contributor],
            **{
                'project': self.public_project,
                'can_contribute': True
            })
        self.public_viewers = UserGroupF(
            add_users=[self.viewer],
            **{
                'project': self.public_project,
                'can_contribute': False,
                'can_moderate': False
            })

        self.public_publicview_project = ProjectF.create(
            add_admins=[self.admin],
            **{
                'name': 'Public with public view',
                'isprivate': False,
                'everyone_contributes': 'false'
            })

        self.public_publicview_view = GroupingFactory(
            **{'project': self.public_publicview_project, 'isprivate': False}
        )
        self.public_publicview_moderators_view = UserGroupF(
            add_users=[self.moderator_view],
            **{
                'project': self.public_publicview_project,
                'can_moderate': True
            })
        self.public_publicview_contributors_view = UserGroupF(
            add_users=[self.contributor_view],
            **{
                'project': self.public_publicview_project,
                'can_contribute': True
            })
        self.public_publicview_viewers_view = UserGroupF(
            add_users=[self.viewer_view],
            **{
                'project': self.public_publicview_project,
                'can_contribute': False,
                'can_moderate': False
            })

        GroupingUserGroupFactory.create(**{
            'grouping': self.public_publicview_view,
            'usergroup': self.public_publicview_moderators_view
        })
        GroupingUserGroupFactory.create(**{
            'grouping': self.public_publicview_view,
            'usergroup': self.public_publicview_contributors_view
        })
        GroupingUserGroupFactory.create(**{
            'grouping': self.public_publicview_view,
            'usergroup': self.public_publicview_viewers_view
        })

        self.public_publicview_moderators = UserGroupF(
            add_users=[self.moderator],
            **{
                'project': self.public_publicview_project,
                'can_moderate': True
            })
        self.public_publicview_contributors = UserGroupF(
            add_users=[self.contributor],
            **{
                'project': self.public_publicview_project,
                'can_contribute': True
            })
        self.public_publicview_viewers = UserGroupF(
            add_users=[self.viewer],
            **{
                'project': self.public_publicview_project,
                'can_contribute': False,
                'can_moderate': False
            })

        self.public_publicviews_project = ProjectF.create(
            add_admins=[self.admin],
            **{
                'name': 'public with all public views',
                'isprivate': False,
                'everyone_contributes': 'false'
            })

        self.public_publicviews_view = GroupingFactory(
            **{'project': self.public_publicviews_project, 'isprivate': False}
        )
        self.public_publicviews_moderators_view = UserGroupF(
            add_users=[self.moderator_view],
            **{
                'project': self.public_publicviews_project,
                'can_moderate': True
            })
        self.public_publicviews_contributors_view = UserGroupF(
            add_users=[self.contributor_view],
            **{
                'project': self.public_publicviews_project,
                'can_contribute': True
            })
        self.public_publicviews_viewers_view = UserGroupF(
            add_users=[self.viewer_view],
            **{
                'project': self.public_publicviews_project,
                'can_contribute': False,
                'can_moderate': False
            })

        GroupingUserGroupFactory.create(**{
            'grouping': self.public_publicviews_view,
            'usergroup': self.public_publicviews_moderators_view
        })
        GroupingUserGroupFactory.create(**{
            'grouping': self.public_publicviews_view,
            'usergroup': self.public_publicviews_contributors_view
        })
        GroupingUserGroupFactory.create(**{
            'grouping': self.public_publicviews_view,
            'usergroup': self.public_publicviews_viewers_view
        })

        self.public_publicviews_moderators = UserGroupF(
            add_users=[self.moderator],
            **{
                'project': self.public_publicviews_project,
                'can_moderate': True
            })
        self.public_publicviews_contributors = UserGroupF(
            add_users=[self.contributor],
            **{
                'project': self.public_publicviews_project,
                'can_contribute': True
            })
        self.public_publicviews_viewers = UserGroupF(
            add_users=[self.viewer],
            **{
                'project': self.public_publicviews_project,
                'can_contribute': False,
                'can_moderate': False
            })
コード例 #7
0
ファイル: test_models.py プロジェクト: tainita01/geokey
    def setUp(self):
        self.moderator_view = UserF.create()
        self.moderator = UserF.create()
        self.contributor_view = UserF.create()
        self.contributor = UserF.create()
        self.viewer_view = UserF.create()
        self.viewer = UserF.create()
        self.some_dude = UserF.create()

        self.project = ProjectF.create(**{
            'isprivate': False,
            'everyone_contributes': 'false'
        })

        self.view = GroupingFactory(
            **{'project': self.project, 'isprivate': False}
        )
        self.moderators_view = UserGroupF(
            add_users=[self.moderator_view],
            **{
                'project': self.project,
                'can_moderate': True
            })
        self.contributors_view = UserGroupF(
            add_users=[self.contributor_view],
            **{
                'project': self.project,
                'can_contribute': True
            })
        self.viewers_view = UserGroupF(
            add_users=[self.viewer_view],
            **{
                'project': self.project,
                'can_contribute': False,
                'can_moderate': False
            })

        GroupingUserGroupFactory.create(
            **{'grouping': self.view, 'usergroup': self.moderators_view})
        GroupingUserGroupFactory.create(
            **{'grouping': self.view, 'usergroup': self.contributors_view})
        GroupingUserGroupFactory.create(
            **{'grouping': self.view, 'usergroup': self.viewers_view})

        self.moderators = UserGroupF(
            add_users=[self.moderator],
            **{
                'project': self.project,
                'can_moderate': True
            })
        self.contributors = UserGroupF(
            add_users=[self.contributor],
            **{
                'project': self.project,
                'can_contribute': True
            })
        self.viewers = UserGroupF(
            add_users=[self.viewer],
            **{
                'project': self.project,
                'can_contribute': False,
                'can_moderate': False
            })
コード例 #8
0
ファイル: test_manager.py プロジェクト: tainita01/geokey
    def setUp(self):
        self.admin = UserF.create()
        self.moderator_view = UserF.create()
        self.moderator = UserF.create()
        self.contributor_view = UserF.create()
        self.contributor = UserF.create()
        self.viewer_view = UserF.create()
        self.viewer = UserF.create()
        self.some_dude = UserF.create()

        self.private_project = ProjectF.create(add_admins=[self.admin],
                                               **{
                                                   'name': 'Private',
                                                   'isprivate': True,
                                                   'everyone_contributes':
                                                   'false'
                                               })

        self.private_view = GroupingFactory(**{
            'project': self.private_project,
            'isprivate': True
        })
        self.private_moderators_view = UserGroupF(
            add_users=[self.moderator_view],
            **{
                'project': self.private_project,
                'can_moderate': True
            })
        self.private_contributors_view = UserGroupF(
            add_users=[self.contributor_view],
            **{
                'project': self.private_project,
                'can_contribute': True
            })
        self.private_viewers_view = UserGroupF(add_users=[self.viewer_view],
                                               **{
                                                   'project':
                                                   self.private_project,
                                                   'can_contribute': False,
                                                   'can_moderate': False
                                               })

        GroupingUserGroupFactory.create(
            **{
                'grouping': self.private_view,
                'usergroup': self.private_moderators_view
            })
        GroupingUserGroupFactory.create(
            **{
                'grouping': self.private_view,
                'usergroup': self.private_contributors_view
            })
        GroupingUserGroupFactory.create(**{
            'grouping': self.private_view,
            'usergroup': self.private_viewers_view
        })

        self.private_moderators = UserGroupF(add_users=[self.moderator],
                                             **{
                                                 'project':
                                                 self.private_project,
                                                 'can_moderate': True
                                             })
        self.private_contributors = UserGroupF(add_users=[self.contributor],
                                               **{
                                                   'project':
                                                   self.private_project,
                                                   'can_contribute': True
                                               })
        self.private_viewers = UserGroupF(add_users=[self.viewer],
                                          **{
                                              'project': self.private_project,
                                              'can_contribute': False,
                                              'can_moderate': False
                                          })

        self.private_publicview_project = ProjectF.create(
            add_admins=[self.admin],
            **{
                'name': 'Private with public view',
                'isprivate': True,
                'everyone_contributes': 'false'
            })

        self.private_publicview_view = GroupingFactory(**{
            'project': self.private_publicview_project,
            'isprivate': False
        })
        self.private_publicview_moderators_view = UserGroupF(
            add_users=[self.moderator_view],
            **{
                'project': self.private_publicview_project,
                'can_moderate': True
            })
        self.private_publicview_contributors_view = UserGroupF(
            add_users=[self.contributor_view],
            **{
                'project': self.private_publicview_project,
                'can_contribute': True
            })
        self.private_publicview_viewers_view = UserGroupF(
            add_users=[self.viewer_view],
            **{
                'project': self.private_publicview_project,
                'can_contribute': False,
                'can_moderate': False
            })

        GroupingUserGroupFactory.create(
            **{
                'grouping': self.private_publicview_view,
                'usergroup': self.private_publicview_moderators_view
            })
        GroupingUserGroupFactory.create(
            **{
                'grouping': self.private_publicview_view,
                'usergroup': self.private_publicview_contributors_view
            })
        GroupingUserGroupFactory.create(
            **{
                'grouping': self.private_publicview_view,
                'usergroup': self.private_publicview_viewers_view
            })

        self.private_publicview_moderators = UserGroupF(
            add_users=[self.moderator],
            **{
                'project': self.private_publicview_project,
                'can_moderate': True
            })
        self.private_publicview_contributors = UserGroupF(
            add_users=[self.contributor],
            **{
                'project': self.private_publicview_project,
                'can_contribute': True
            })
        self.private_publicview_viewers = UserGroupF(
            add_users=[self.viewer],
            **{
                'project': self.private_publicview_project,
                'can_contribute': False,
                'can_moderate': False
            })

        self.private_publicviews_project = ProjectF.create(
            add_admins=[self.admin],
            **{
                'name': 'Private with public views',
                'isprivate': True,
                'everyone_contributes': 'false'
            })

        self.private_publicviews_view = GroupingFactory(**{
            'project': self.private_publicviews_project,
            'isprivate': False
        })
        self.private_publicviews_moderators_view = UserGroupF(
            add_users=[self.moderator_view],
            **{
                'project': self.private_publicviews_project,
                'can_moderate': True
            })
        self.private_publicviews_contributors_view = UserGroupF(
            add_users=[self.contributor_view],
            **{
                'project': self.private_publicviews_project,
                'can_contribute': True
            })
        self.private_publicviews_viewers_view = UserGroupF(
            add_users=[self.viewer_view],
            **{
                'project': self.private_publicviews_project,
                'can_contribute': False,
                'can_moderate': False
            })

        GroupingUserGroupFactory.create(
            **{
                'grouping': self.private_publicviews_view,
                'usergroup': self.private_publicviews_moderators_view
            })
        GroupingUserGroupFactory.create(
            **{
                'grouping': self.private_publicviews_view,
                'usergroup': self.private_publicviews_contributors_view
            })
        GroupingUserGroupFactory.create(
            **{
                'grouping': self.private_publicviews_view,
                'usergroup': self.private_publicviews_viewers_view
            })

        self.private_publicviews_moderators = UserGroupF(
            add_users=[self.moderator],
            **{
                'project': self.private_publicviews_project,
                'can_moderate': True
            })
        self.private_publicviews_contributors = UserGroupF(
            add_users=[self.contributor],
            **{
                'project': self.private_publicviews_project,
                'can_contribute': True
            })
        self.private_publicviews_viewers = UserGroupF(
            add_users=[self.viewer],
            **{
                'project': self.private_publicviews_project,
                'can_contribute': False,
                'can_moderate': False
            })

        self.public_project = ProjectF.create(add_admins=[self.admin],
                                              **{
                                                  'name': 'Public',
                                                  'isprivate': False,
                                                  'everyone_contributes':
                                                  'false'
                                              })

        self.public_view = GroupingFactory(**{
            'project': self.public_project,
            'isprivate': True
        })
        self.public_moderators_view = UserGroupF(
            add_users=[self.moderator_view],
            **{
                'project': self.public_project,
                'can_moderate': True
            })
        self.public_contributors_view = UserGroupF(
            add_users=[self.contributor_view],
            **{
                'project': self.public_project,
                'can_contribute': True
            })
        self.public_viewers_view = UserGroupF(add_users=[self.viewer_view],
                                              **{
                                                  'project':
                                                  self.public_project,
                                                  'can_contribute': False,
                                                  'can_moderate': False
                                              })

        GroupingUserGroupFactory.create(
            **{
                'grouping': self.public_view,
                'usergroup': self.public_moderators_view
            })
        GroupingUserGroupFactory.create(
            **{
                'grouping': self.public_view,
                'usergroup': self.public_contributors_view
            })
        GroupingUserGroupFactory.create(**{
            'grouping': self.public_view,
            'usergroup': self.public_viewers_view
        })

        self.public_moderators = UserGroupF(add_users=[self.moderator],
                                            **{
                                                'project': self.public_project,
                                                'can_moderate': True
                                            })
        self.public_contributors = UserGroupF(add_users=[self.contributor],
                                              **{
                                                  'project':
                                                  self.public_project,
                                                  'can_contribute': True
                                              })
        self.public_viewers = UserGroupF(add_users=[self.viewer],
                                         **{
                                             'project': self.public_project,
                                             'can_contribute': False,
                                             'can_moderate': False
                                         })

        self.public_publicview_project = ProjectF.create(
            add_admins=[self.admin],
            **{
                'name': 'Public with public view',
                'isprivate': False,
                'everyone_contributes': 'false'
            })

        self.public_publicview_view = GroupingFactory(**{
            'project': self.public_publicview_project,
            'isprivate': False
        })
        self.public_publicview_moderators_view = UserGroupF(
            add_users=[self.moderator_view],
            **{
                'project': self.public_publicview_project,
                'can_moderate': True
            })
        self.public_publicview_contributors_view = UserGroupF(
            add_users=[self.contributor_view],
            **{
                'project': self.public_publicview_project,
                'can_contribute': True
            })
        self.public_publicview_viewers_view = UserGroupF(
            add_users=[self.viewer_view],
            **{
                'project': self.public_publicview_project,
                'can_contribute': False,
                'can_moderate': False
            })

        GroupingUserGroupFactory.create(
            **{
                'grouping': self.public_publicview_view,
                'usergroup': self.public_publicview_moderators_view
            })
        GroupingUserGroupFactory.create(
            **{
                'grouping': self.public_publicview_view,
                'usergroup': self.public_publicview_contributors_view
            })
        GroupingUserGroupFactory.create(
            **{
                'grouping': self.public_publicview_view,
                'usergroup': self.public_publicview_viewers_view
            })

        self.public_publicview_moderators = UserGroupF(
            add_users=[self.moderator],
            **{
                'project': self.public_publicview_project,
                'can_moderate': True
            })
        self.public_publicview_contributors = UserGroupF(
            add_users=[self.contributor],
            **{
                'project': self.public_publicview_project,
                'can_contribute': True
            })
        self.public_publicview_viewers = UserGroupF(
            add_users=[self.viewer],
            **{
                'project': self.public_publicview_project,
                'can_contribute': False,
                'can_moderate': False
            })

        self.public_publicviews_project = ProjectF.create(
            add_admins=[self.admin],
            **{
                'name': 'public with all public views',
                'isprivate': False,
                'everyone_contributes': 'false'
            })

        self.public_publicviews_view = GroupingFactory(**{
            'project': self.public_publicviews_project,
            'isprivate': False
        })
        self.public_publicviews_moderators_view = UserGroupF(
            add_users=[self.moderator_view],
            **{
                'project': self.public_publicviews_project,
                'can_moderate': True
            })
        self.public_publicviews_contributors_view = UserGroupF(
            add_users=[self.contributor_view],
            **{
                'project': self.public_publicviews_project,
                'can_contribute': True
            })
        self.public_publicviews_viewers_view = UserGroupF(
            add_users=[self.viewer_view],
            **{
                'project': self.public_publicviews_project,
                'can_contribute': False,
                'can_moderate': False
            })

        GroupingUserGroupFactory.create(
            **{
                'grouping': self.public_publicviews_view,
                'usergroup': self.public_publicviews_moderators_view
            })
        GroupingUserGroupFactory.create(
            **{
                'grouping': self.public_publicviews_view,
                'usergroup': self.public_publicviews_contributors_view
            })
        GroupingUserGroupFactory.create(
            **{
                'grouping': self.public_publicviews_view,
                'usergroup': self.public_publicviews_viewers_view
            })

        self.public_publicviews_moderators = UserGroupF(
            add_users=[self.moderator],
            **{
                'project': self.public_publicviews_project,
                'can_moderate': True
            })
        self.public_publicviews_contributors = UserGroupF(
            add_users=[self.contributor],
            **{
                'project': self.public_publicviews_project,
                'can_contribute': True
            })
        self.public_publicviews_viewers = UserGroupF(
            add_users=[self.viewer],
            **{
                'project': self.public_publicviews_project,
                'can_contribute': False,
                'can_moderate': False
            })