Ejemplo n.º 1
0
    def test_add_to_permissions_group_group_does_not_exist(self):
        self.user.groups.all().delete()

        period_models.add_to_permissions_group(period_models.User, self.user)

        groups = self.user.groups.all()
        self.assertEqual(1, groups.count())
        self.assertEqual(3, groups.first().permissions.count())
        for permission in groups.first().permissions.all():
            self.assertEqual('_flowevent', permission.codename[-10:])
Ejemplo n.º 2
0
    def test_add_to_permissions_group_group_does_not_exist(self):
        self.user.groups.all().delete()

        period_models.add_to_permissions_group(period_models.User, self.user)

        groups = self.user.groups.all()
        self.assertEqual(1, groups.count())
        self.assertEqual(3, groups[0].permissions.count())
        for permission in groups[0].permissions.all():
            self.assertEqual('_flowevent', permission.codename[-10:])
Ejemplo n.º 3
0
    def test_add_to_permissions_group_group_exists(self):
        user = period_models.User(email='*****@*****.**')
        user.save()
        user.groups.all().delete()
        auth_models.Group(name='users').save()

        period_models.add_to_permissions_group(period_models.User, user)

        groups = user.groups.all()
        self.assertEqual(1, groups.count())
        self.assertEqual(0, groups[0].permissions.count())
Ejemplo n.º 4
0
    def test_add_to_permissions_group_group_exists(self):
        user = period_models.User(email='*****@*****.**',
                                  last_login=TIMEZONE.localize(datetime.datetime(2015, 2, 27)))
        user.save()
        user.groups.all().delete()
        auth_models.Group(name='users').save()

        period_models.add_to_permissions_group(period_models.User, user)

        groups = user.groups.all()
        self.assertEqual(1, groups.count())
        self.assertEqual(0, groups[0].permissions.count())
Ejemplo n.º 5
0
    def test_add_to_permissions_group_group_exists(self):
        user = period_models.User(email='*****@*****.**',
                                  last_login=TIMEZONE.localize(
                                      datetime.datetime(2015, 2, 27)))
        user.save()
        user.groups.all().delete()
        auth_models.Group(name='users').save()

        period_models.add_to_permissions_group(period_models.User, user)

        groups = user.groups.all()
        self.assertEqual(1, groups.count())
        self.assertEqual(0, groups.first().permissions.count())