Beispiel #1
0
    def _create_profile(self, name, pid=None, context=None):
        profile = pb.Profile(name, self.spec,
                             user=self.ctx.user,
                             project=self.ctx.project,
                             domain=self.ctx.domain,
                             context=context)
        if pid:
            profile.id = pid
            profile.context = context

        return profile
Beispiel #2
0
    def test_validate_for_update_failed(self):
        profile = self._create_profile('test-profile')

        # Property is not updatable
        new_spec = copy.deepcopy(self.spec)
        new_spec['properties']['key3'] = 'new_v3'
        new_profile = pb.Profile('new-profile', new_spec,
                                 user=self.ctx.user,
                                 project=self.ctx.project,
                                 domain=self.ctx.domain,
                                 context=None)

        res = profile.validate_for_update(new_profile)
        self.assertFalse(res)
Beispiel #3
0
    def test_validate_for_update_succeeded(self):
        profile = self._create_profile('test-profile')

        # Properties are updatable
        new_spec = copy.deepcopy(self.spec)
        new_spec['properties']['key1'] = 'new_v1'
        new_spec['properties']['key2'] = 3
        new_profile = pb.Profile('new-profile', new_spec,
                                 user=self.ctx.user,
                                 project=self.ctx.project,
                                 domain=self.ctx.domain,
                                 context=None)
        res = profile.validate_for_update(new_profile)
        self.assertTrue(res)