Esempio n. 1
0
    def test_model_to_files(self):
        with TemporaryDirectory() as td:
            fm = FileContentsManager(root_dir=td)
            model = fm.create_file()
            # need content
            model = fm.get_model(model['name'], model['path'])
            files = model_to_files(model)
            name = model['name']
            # files should only contain one file
            nt.assert_items_equal(files, [name])

            # add a file
            model['__files'] = {'file1.txt': 'file1txt content'}
            files = model_to_files(model)
            nt.assert_items_equal(files, [name, 'file1.txt'])
            nt.assert_equal(files['file1.txt'], 'file1txt content')
Esempio n. 2
0
    def test_model_to_files(self):
        with TemporaryDirectory() as td:
            fm = FileContentsManager(root_dir=td)
            model = fm.create_file()
            # need content
            model = fm.get_model(model['name'], model['path'])
            files = model_to_files(model)
            name = model['name']
            # files should only contain one file
            nt.assert_items_equal(files, [name])

            # add a file
            model['__files'] = {'file1.txt': 'file1txt content'}
            files = model_to_files(model)
            nt.assert_items_equal(files, [name, 'file1.txt'])
            nt.assert_equal(files['file1.txt'],
                            'file1txt content')