def test_addnew_invalidname(self):
        from plone.resourceeditor.browser import FileManager
        r = self._make_directory()

        view = FileManager(r, self.layer['request'])

        for char in '\\/:*?"<>':
            info = view.addNew('/', 'foo' + char)
            self.assertEqual(info['code'], 1)
            self.assertNotEqual(info['error'], '')
Пример #2
0
    def test_addnew_invalidname(self):
        from plone.resourceeditor.browser import FileManager
        r = self._make_directory()

        view = FileManager(r, self.layer['request'])

        for char in '\\/:*?"<>':
            info = view.addNew('/', 'foo' + char)
            self.assertEqual(info['code'], 1)
            self.assertNotEqual(info['error'], '')
Пример #3
0
 def test_resource_created_or_modified(self):
     request = FakeRequest()
     r = self._make_directory()
     view = FileManager(r, request)
     info = view.addNew('/', 'test_tile.yaml')
     self.assertEqual(info['code'], 0)
     self.assertEqual(info['error'], '')
     self.assertEqual(info['name'], 'test_tile.yaml')
     self.assertEqual(info['parent'], '/')
     self.assertEqual(r.readFile('test_tile.yaml'), '')
Пример #4
0
 def test_resource_created_or_modified(self):
     request = FakeRequest()
     r = self._make_directory()
     view = FileManager(r, request)
     info = view.addNew('/', 'test_tile.yaml')
     self.assertEqual(info['code'], 0)
     self.assertEqual(info['error'], '')
     self.assertEqual(info['name'], 'test_tile.yaml')
     self.assertEqual(info['parent'], '/')
     self.assertEqual(r.readFile('test_tile.yaml'), '')
Пример #5
0
    def test_addnew_invalidname(self):
        from plone.resourceeditor.browser import FileManager

        r = self._make_directory()

        view = FileManager(r, self.layer["request"])

        for char in '\\/:*?"<>':
            info = view.addNew("/", "foo" + char)
            self.assertEqual(info["code"], 1)
            self.assertNotEqual(info["error"], "")
    def test_addnew_exists(self):
        from plone.resourceeditor.browser import FileManager
        r = self._make_directory()
        r.writeFile('test.txt', b'foo')

        view = FileManager(r, self.layer['request'])

        info = view.addNew('/', 'test.txt')

        self.assertEqual(info['code'], 1)
        self.assertNotEqual(info['error'], '')

        self.assertEqual(r.readFile('test.txt'), b'foo')
Пример #7
0
    def test_addnew_exists(self):
        from plone.resourceeditor.browser import FileManager
        r = self._make_directory()
        r.writeFile('test.txt', 'foo')

        view = FileManager(r, self.layer['request'])

        info = view.addNew('/', 'test.txt')

        self.assertEqual(info['code'], 1)
        self.assertNotEqual(info['error'], '')

        self.assertEqual(r.readFile('test.txt'), 'foo')
Пример #8
0
    def test_addnew_exists(self):
        from plone.resourceeditor.browser import FileManager

        r = self._make_directory()
        r.writeFile("test.txt", "foo")

        view = FileManager(r, self.layer["request"])

        info = view.addNew("/", "test.txt")

        self.assertEqual(info["code"], 1)
        self.assertNotEqual(info["error"], "")

        self.assertEqual(r.readFile("test.txt"), "foo")
    def test_addnew(self):
        from plone.resourceeditor.browser import FileManager
        r = self._make_directory()

        view = FileManager(r, self.layer['request'])

        info = view.addNew('/', 'test.txt')

        self.assertEqual(info['code'], 0)
        self.assertEqual(info['error'], '')
        self.assertEqual(info['name'], 'test.txt')
        self.assertEqual(info['parent'], '/')

        self.assertEqual(r.readFile('test.txt'), b'')
Пример #10
0
    def test_addnew(self):
        from plone.resourceeditor.browser import FileManager
        r = self._make_directory()

        view = FileManager(r, self.layer['request'])

        info = view.addNew('/', 'test.txt')

        self.assertEqual(info['code'], 0)
        self.assertEqual(info['error'], '')
        self.assertEqual(info['name'], 'test.txt')
        self.assertEqual(info['parent'], '/')

        self.assertEqual(r.readFile('test.txt'), '')
Пример #11
0
    def test_addnew(self):
        from plone.resourceeditor.browser import FileManager

        r = self._make_directory()

        view = FileManager(r, self.layer["request"])

        info = view.addNew("/", "test.txt")

        self.assertEqual(info["code"], 0)
        self.assertEqual(info["error"], "")
        self.assertEqual(info["name"], "test.txt")
        self.assertEqual(info["parent"], "/")

        self.assertEqual(r.readFile("test.txt"), "")