Пример #1
0
 def test_create_organization_team(self):
     profile = utils.create_organization("modilabs", self.user)
     organization = profile.user
     team_name = 'dev'
     perms = ['is_org_owner', ]
     utils.create_organization_team(organization, team_name, perms)
     team_name = "modilabs#%s" % team_name
     dev_team = Team.objects.get(organization=organization, name=team_name)
     self.assertIsInstance(dev_team, Team)
     self.assertIsInstance(
         dev_team.permissions.get(codename='is_org_owner'), Permission)
Пример #2
0
 def test_create_organization_team(self):
     profile = utils.create_organization("modilabs", self.user)
     organization = profile.user
     team_name = 'dev'
     perms = [
         'is_org_owner',
     ]
     utils.create_organization_team(organization, team_name, perms)
     team_name = "modilabs#%s" % team_name
     dev_team = Team.objects.get(organization=organization, name=team_name)
     self.assertIsInstance(dev_team, Team)
     self.assertIsInstance(
         dev_team.permissions.get(codename='is_org_owner'), Permission)
Пример #3
0
    def test_create_organization_creates_team_and_perms(self):
        # create a user - bob
        profile = utils.create_organization("modilabs", self.user)
        self.assertIsInstance(profile, OrganizationProfile)
        organization_profile = OrganizationProfile.objects.get(
            user__username="******")

        # check organization was created
        self.assertTrue(organization_profile.is_organization)

        # check that the default team was created
        team_name = "modilabs#%s" % Team.OWNER_TEAM_NAME
        team = Team.objects.get(
            organization=organization_profile.user, name=team_name)
        self.assertIsInstance(team, Team)
        self.assertIn(team.group_ptr, self.user.groups.all())
        self.assertTrue(self.user.has_perm('api.is_org_owner'))
Пример #4
0
    def test_create_organization_creates_team_and_perms(self):
        # create a user - bob
        profile = utils.create_organization("modilabs", self.user)
        self.assertIsInstance(profile, OrganizationProfile)
        organization_profile = OrganizationProfile.objects.get(
            user__username="******")

        # check organization was created
        self.assertTrue(organization_profile.is_organization)

        # check that the default team was created
        team_name = "modilabs#%s" % Team.OWNER_TEAM_NAME
        team = Team.objects.get(organization=organization_profile.user,
                                name=team_name)
        self.assertIsInstance(team, Team)
        self.assertIn(team.group_ptr, self.user.groups.all())
        self.assertTrue(self.user.has_perm('api.is_org_owner'))
Пример #5
0
 def _create_organization(self, org_name, user):
     profile = utils.create_organization(org_name, user)
     self.organization = profile.user
     return self.organization
Пример #6
0
 def _create_organization(self, org_name, user):
     profile = utils.create_organization(org_name, user)
     self.organization = profile.user
     return self.organization