Esempio n. 1
0
 def test_creates_directories(self):
     # When given directory specifications, it creates those directories.
     path = self.useFixture(TempDir()).path
     create_normal_shape(path, [('a/', None), ('b/', None)])
     self.assertThat(path, DirContains(['a', 'b']))
     self.assertThat(os.path.join(path, 'a'), DirExists())
     self.assertThat(os.path.join(path, 'b'), DirExists())
Esempio n. 2
0
 def test_creates_directories(self):
     # When given directory specifications, it creates those directories.
     path = self.useFixture(TempDir()).path
     create_normal_shape(path, [('a/', None), ('b/', None)])
     self.assertThat(path, DirContains(['a', 'b']))
     self.assertThat(os.path.join(path, 'a'), DirExists())
     self.assertThat(os.path.join(path, 'b'), DirExists())
Esempio n. 3
0
 def test_creates_files(self):
     # When given a list of file specifications, it creates those files
     # underneath the temporary directory.
     path = self.useFixture(TempDir()).path
     create_normal_shape(path, [('a', 'foo'), ('b', 'bar')])
     self.assertThat(path, DirContains(['a', 'b']))
     self.assertThat(os.path.join(path, 'a'), FileContains('foo'))
     self.assertThat(os.path.join(path, 'b'), FileContains('bar'))
Esempio n. 4
0
 def test_creates_files(self):
     # When given a list of file specifications, it creates those files
     # underneath the temporary directory.
     path = self.useFixture(TempDir()).path
     create_normal_shape(path, [('a', 'foo'), ('b', 'bar')])
     self.assertThat(path, DirContains(['a', 'b']))
     self.assertThat(os.path.join(path, 'a'), FileContains('foo'))
     self.assertThat(os.path.join(path, 'b'), FileContains('bar'))
Esempio n. 5
0
 def test_creates_parent_directories(self):
     # If the parents of a file or directory don't exist, they get created
     # too.
     path = self.useFixture(TempDir()).path
     create_normal_shape(path, [('a/b/', None), ('c/d.txt', 'text')])
     self.assertThat(path, DirContains(['a', 'c']))
     self.assertThat(os.path.join(path, 'a'), DirContains('b'))
     self.assertThat(os.path.join(path, 'a', 'b'), DirExists())
     self.assertThat(os.path.join(path, 'c'), DirExists())
     self.assertThat(os.path.join(path, 'c', 'd.txt'), FileContains('text'))
Esempio n. 6
0
 def test_creates_parent_directories(self):
     # If the parents of a file or directory don't exist, they get created
     # too.
     path = self.useFixture(TempDir()).path
     create_normal_shape(path, [('a/b/', None), ('c/d.txt', 'text')])
     self.assertThat(path, DirContains(['a', 'c']))
     self.assertThat(os.path.join(path, 'a'), DirContains('b'))
     self.assertThat(os.path.join(path, 'a', 'b'), DirExists())
     self.assertThat(os.path.join(path, 'c'), DirExists())
     self.assertThat(os.path.join(path, 'c', 'd.txt'), FileContains('text'))
Esempio n. 7
0
 def test_empty(self):
     tempdir = self.useFixture(TempDir()).path
     create_normal_shape(tempdir, [])
     self.assertThat(tempdir, DirContains([]))
Esempio n. 8
0
 def test_empty(self):
     tempdir = self.useFixture(TempDir()).path
     create_normal_shape(tempdir, [])
     self.assertThat(tempdir, DirContains([]))