Exemplo n.º 1
0
 def test_raises_when_trying_read_nonexistent_file(self):
     assert_raise_library_error(
         lambda: env_file.GhostFile("some role", content=None).read(),
         (severities.ERROR, report_codes.FILE_DOES_NOT_EXIST, {
             "file_role": "some role",
         }),
     )
Exemplo n.º 2
0
 def test_return_True_after_write(self):
     ghost_file = env_file.GhostFile("some_role")
     ghost_file.write("any content")
     self.assertTrue(ghost_file.exists)
Exemplo n.º 3
0
 def test_return_False_if_file_exists(self):
     self.assertFalse(env_file.GhostFile("some_role").exists)
Exemplo n.º 4
0
 def test_return_true_if_file_exists(self):
     self.assertTrue(env_file.GhostFile("some_role", "any content").exists)
Exemplo n.º 5
0
 def test_accepts_is_binary_attribute(self):
     ghost_file = env_file.GhostFile("some role",
                                     content=None,
                                     is_binary=True)
     self.assertTrue(ghost_file.export()["is_binary"])
Exemplo n.º 6
0
 def test_is_not_binary_default(self):
     ghost_file = env_file.GhostFile("some role", content=None)
     self.assertFalse(ghost_file.export()["is_binary"])