def test_subscription_perm(self):
        repo = Repository(name='repo1')
        repo.save()
        repo.uploaders.add(self.user1)
        repo.save()

        series = Series(name='series1', base_ubuntu_series_id='precise', repository=repo)
        series.save()

        pkg_src = PackageSource(code_url='scheme://foo/bar', packaging_url='scheme://foo/bar',
                                flavor='OpenStack')
        pkg_src.save()

        sub = Subscription(target_series=series, source=pkg_src, counter=1)
        sub.save()
        self.assertTrue(sub.can_modify(self.user1), 'User1 cannot modify repository')
        self.assertFalse(sub.can_modify(self.user2), 'User2 can modify repository')
        self.assertTrue(sub.can_modify(self.superuser), 'Super user cannot modify repository')
Esempio n. 2
0
    def test_subscription_perm(self):
        repo = Repository(name='repo1')
        repo.save()
        repo.uploaders.add(self.user1)
        repo.save()

        series = Series(name='series1',
                        base_ubuntu_series_id='precise',
                        repository=repo)
        series.save()

        pkg_src = PackageSource(code_url='scheme://foo/bar',
                                packaging_url='scheme://foo/bar',
                                flavor='OpenStack')
        pkg_src.save()

        sub = Subscription(target_series=series, source=pkg_src, counter=1)
        sub.save()
        self.assertTrue(sub.can_modify(self.user1),
                        'User1 cannot modify repository')
        self.assertFalse(sub.can_modify(self.user2),
                         'User2 can modify repository')
        self.assertTrue(sub.can_modify(self.superuser),
                        'Super user cannot modify repository')
    def test_series_perm(self):
        repo = Repository(name='repo1')
        repo.save()
        repo.uploaders.add(self.user1)
        repo.save()

        series = Series(name='series1', base_ubuntu_series_id='precise', repository=repo)
        series.save()

        self.assertTrue(series.can_modify(self.user1), 'User1 cannot modify repository')
        self.assertFalse(series.can_modify(self.user2), 'User2 can modify repository')
        self.assertTrue(series.can_modify(self.superuser), 'Super user cannot modify repository')
Esempio n. 4
0
    def test_series_perm(self):
        repo = Repository(name='repo1')
        repo.save()
        repo.uploaders.add(self.user1)
        repo.save()

        series = Series(name='series1',
                        base_ubuntu_series_id='precise',
                        repository=repo)
        series.save()

        self.assertTrue(series.can_modify(self.user1),
                        'User1 cannot modify repository')
        self.assertFalse(series.can_modify(self.user2),
                         'User2 can modify repository')
        self.assertTrue(series.can_modify(self.superuser),
                        'Super user cannot modify repository')