Esempio n. 1
0
 def test_replace_collection_for_sanity(self):
     '''
     Check if the replace functionalities are implemented correctly.
     '''
     res1 = Resource('/foo/target', self.kind, [self.mixin], [])
     res2 = Resource('/foo/target', self.kind, [], [])
     workflow.replace_collection(self.mixin, [res1], [res2], self.registry)
     self.assertTrue(self.mixin not in res1.mixins)
     self.assertTrue(self.mixin in res2.mixins)
Esempio n. 2
0
 def test_replace_collection_for_sanity(self):
     '''
     Check if the replace functionalities are implemented correctly.
     '''
     res1 = Resource('/foo/target', self.kind, [self.mixin], [])
     res2 = Resource('/foo/target', self.kind, [], [])
     workflow.replace_collection(self.mixin, [res1], [res2], self.registry)
     self.assertTrue(self.mixin not in res1.mixins)
     self.assertTrue(self.mixin in res2.mixins)
Esempio n. 3
0
    def put(self, key):
        # replace
        try:
            if key == '' or key[-1] != '/':
                key += '/'
            mixin = self.registry.get_category(key)
            new_entities = self.parse_entities()
            old_entities = workflow.get_entities_under_path(key, self.registry)
            workflow.replace_collection(mixin, old_entities, new_entities,
                                        self.registry)

            self.response(200, self.registry.get_default_type(), None)
        except AttributeError as attr:
            raise HTTPError(400, str(attr))