Esempio n. 1
0
    def test_all_contacts(self):
        admin = UserF.create()
        contributor = UserF.create()
        email_user = UserF.create()

        project = ProjectF.create(add_admins=[admin],
                                  add_contributors=[contributor])

        project.contact_admins(email_user, 'Test email')
        # Should be 2 because project creator is admin too
        self.assertEquals(len(mail.outbox), 2)
Esempio n. 2
0
 def setUp(self):
     self.admin = UserF.create()
     self.contributor = UserF.create()
     self.view1_user = UserF.create()
     self.view2_user = UserF.create()
     self.non_member = UserF.create()
     self.project = ProjectF(add_admins=[self.admin],
                             add_contributors=[self.contributor])
     self.view1 = GroupingFactory(add_viewers=[self.view1_user],
                                  **{'project': self.project})
     self.view2 = GroupingFactory(add_viewers=[self.view2_user],
                                  **{'project': self.project})
Esempio n. 3
0
    def test_selected_contacts(self):
        admin = UserF.create()
        contributor = UserF.create()
        email_user = UserF.create()

        project = ProjectF.create(add_admins=[admin],
                                  add_contributors=[contributor])

        admin_rel = Admins.objects.get(project=project, user=admin)
        admin_rel.contact = False
        admin_rel.save()

        project.contact_admins(email_user, 'Test email')
        self.assertEquals(len(mail.outbox), 1)
Esempio n. 4
0
 def setUp(self):
     self.admin = UserF.create()
     self.contributor = UserF.create()
     self.view1_user = UserF.create()
     self.view2_user = UserF.create()
     self.non_member = UserF.create()
     self.project = ProjectF(
         add_admins=[self.admin],
         add_contributors=[self.contributor]
     )
     self.view1 = GroupingFactory(add_viewers=[self.view1_user], **{
         'project': self.project
     })
     self.view2 = GroupingFactory(add_viewers=[self.view2_user], **{
         'project': self.project
     })
Esempio n. 5
0
    def test_some_dude(self):
        user = UserF.create()

        view = GroupingFactory.create()

        self.assertFalse(view.can_view(user))
        self.assertFalse(view.can_read(user))
        self.assertFalse(view.can_moderate(user))
Esempio n. 6
0
 def test_get_type_name(self):
     image_file = ImageFile.objects.create(
         name='Test name',
         description='Test Description',
         contribution=ObservationFactory.create(),
         creator=UserF.create(),
         image=get_image())
     self.assertEqual(image_file.type_name, 'ImageFile')
Esempio n. 7
0
    def test_some_dude(self):
        user = UserF.create()

        view = GroupingFactory.create()

        self.assertFalse(view.can_view(user))
        self.assertFalse(view.can_read(user))
        self.assertFalse(view.can_moderate(user))
Esempio n. 8
0
 def test_get_type_name(self):
     image_file = ImageFile.objects.create(
         name='Test name',
         description='Test Description',
         contribution=ObservationFactory.create(),
         creator=UserF.create(),
         image=get_image()
     )
     self.assertEqual(image_file.type_name, 'ImageFile')
Esempio n. 9
0
 def test_delete_file(self):
     image_file = ImageFile.objects.create(
         name='Test name',
         description='Test Description',
         contribution=ObservationFactory.create(),
         creator=UserF.create(),
         image=get_image())
     image_file.delete()
     self.assertEquals(image_file.status, 'deleted')
Esempio n. 10
0
    def test_create_image(self):
        image_file = MediaFile.objects.create(
            name='Test name',
            description='Test Description',
            contribution=ObservationFactory.create(),
            creator=UserF.create(),
            the_file=get_image())

        self.assertIsNotNone(image_file.image)
        self.assertEqual(image_file.type_name, 'ImageFile')
Esempio n. 11
0
 def test_delete_file(self):
     image_file = ImageFile.objects.create(
         name='Test name',
         description='Test Description',
         contribution=ObservationFactory.create(),
         creator=UserF.create(),
         image=get_image()
     )
     image_file.delete()
     self.assertEquals(image_file.status, 'deleted')
Esempio n. 12
0
 def test_get_type_name(self):
     image_file = VideoFile.objects.create(
         name='Test name',
         description='Test Description',
         contribution=ObservationFactory.create(),
         creator=UserF.create(),
         video=get_image(),
         youtube_link='http://example.com/1122323',
         swf_link='http://example.com/1122323.swf')
     self.assertEqual(image_file.type_name, 'VideoFile')
Esempio n. 13
0
    def test_admin(self):
        user = UserF.create()
        project = ProjectF.create(add_admins=[user])
        view = GroupingFactory.create(**{
            'project': project,
            'isprivate': False
        })

        self.assertTrue(view.can_view(user))
        self.assertTrue(view.can_read(user))
        self.assertTrue(view.can_moderate(user))
Esempio n. 14
0
    def test_get_is_owner(self):
        image = ImageFileFactory.create()

        serializer = FileSerializer(image, context={'user': image.creator})
        self.assertTrue(serializer.get_is_owner(image))

        serializer = FileSerializer(image, context={'user': UserF.create()})
        self.assertFalse(serializer.get_is_owner(image))

        serializer = FileSerializer(image, context={'user': AnonymousUser()})
        self.assertFalse(serializer.get_is_owner(image))
Esempio n. 15
0
    def test_admin(self):
        user = UserF.create()
        project = ProjectF.create(add_admins=[user])
        view = GroupingFactory.create(**{
            'project': project,
            'isprivate': False
        })

        self.assertTrue(view.can_view(user))
        self.assertTrue(view.can_read(user))
        self.assertTrue(view.can_moderate(user))
Esempio n. 16
0
    def test_get_is_owner(self):
        image = ImageFileFactory.create()

        serializer = FileSerializer(image, context={'user': image.creator})
        self.assertTrue(serializer.get_is_owner(image))

        serializer = FileSerializer(image, context={'user': UserF.create()})
        self.assertFalse(serializer.get_is_owner(image))

        serializer = FileSerializer(image, context={'user': AnonymousUser()})
        self.assertFalse(serializer.get_is_owner(image))
Esempio n. 17
0
    def test_create_image(self):
        image_file = MediaFile.objects.create(
            name='Test name',
            description='Test Description',
            contribution=ObservationFactory.create(),
            creator=UserF.create(),
            the_file=get_image()
        )

        self.assertIsNotNone(image_file.image)
        self.assertEqual(image_file.type_name, 'ImageFile')
Esempio n. 18
0
 def test_get_type_name(self):
     image_file = VideoFile.objects.create(
         name='Test name',
         description='Test Description',
         contribution=ObservationFactory.create(),
         creator=UserF.create(),
         video=get_image(),
         youtube_link='http://example.com/1122323',
         swf_link='http://example.com/1122323.swf'
     )
     self.assertEqual(image_file.type_name, 'VideoFile')
Esempio n. 19
0
    def test_create_not_supported(self):
        xyz_file = StringIO()
        xyz = Image.new('RGBA', size=(50, 50), color=(256, 0, 0))
        xyz.save(xyz_file, 'png')
        xyz_file.seek(0)

        the_file = ContentFile(xyz_file.read(), 'test.xyz')
        the_file.content_type = 'chemical/x-xyz'

        MediaFile.objects.create(name='Test name',
                                 description='Test Description',
                                 contribution=ObservationFactory.create(),
                                 creator=UserF.create(),
                                 the_file=the_file)
Esempio n. 20
0
    def test_create_not_supported(self):
        xyz_file = StringIO()
        xyz = Image.new('RGBA', size=(50, 50), color=(256, 0, 0))
        xyz.save(xyz_file, 'png')
        xyz_file.seek(0)

        the_file = ContentFile(xyz_file.read(), 'test.xyz')
        the_file.content_type = 'chemical/x-xyz'

        MediaFile.objects.create(
            name='Test name',
            description='Test Description',
            contribution=ObservationFactory.create(),
            creator=UserF.create(),
            the_file=the_file
        )
Esempio n. 21
0
    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))
Esempio n. 22
0
    def test_get_updated_data(self):
        project = ProjectF()
        category_1 = CategoryFactory(**{'project': project})
        TextFieldFactory(**{'key': 'text', 'category': category_1})

        observation = ObservationFactory(
            **{
                'project': project,
                'category': category_1,
                'attributes': {
                    'text': 'yes to update'
                }
            })

        for x in range(0, 5):
            ObservationFactory(
                **{
                    'project': project,
                    'category': category_1,
                    'attributes': {
                        'text': 'yes ' + str(x)
                    }
                })

            ObservationFactory(
                **{
                    'project': project,
                    'category': category_1,
                    'attributes': {
                        'text': 'no ' + str(x)
                    }
                })

        view = GroupingFactory(**{'project': project})
        RuleFactory(**{
            'grouping': view,
            'category': category_1,
            'filters': {
                'text': 'yes'
            }
        })

        updater = UserF()
        update = {'text': 'yes, this has been updated', 'version': 1}
        observation.update(attributes=update, updator=updater)
        self.assertEqual(len(view.data), 6)
Esempio n. 23
0
    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))
Esempio n. 24
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
                                  })
Esempio n. 25
0
    def test_create_project(self):
        creator = UserF.create()

        project = Project.create('Test', 'Test desc', True, True, creator)
        self.assertIn(creator, project.admins.all())
Esempio n. 26
0
    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
            })
Esempio n. 27
0
    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
            })