Ejemplo n.º 1
0
    def test_get(self):
        """
            Make sure that proper contentobjects are returned (of the
            custom class, if defined).
        """
        url = self.gen_rand_str()
        content = self.mapper.get(url)
        assert content == None

        f = open(self.mapper.url2path(url), 'w')
        f.close()
        content = self.mapper.get(url)
        assert content != None
        assert isinstance(content, Content)

        class CustomContent(Content):
            pass

        custommapper = Mapper(self.path, contentclass=CustomContent)
        content = custommapper.get(url)
        assert content != None
        assert isinstance(content, CustomContent)
Ejemplo n.º 2
0
 def setUp(self):
     super(MapperTestCase, self).setUp()
     self.mapper = Mapper(self.path)