示例#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",
         }),
     )
示例#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)
示例#3
0
 def test_return_False_if_file_exists(self):
     self.assertFalse(env_file.GhostFile("some_role").exists)
示例#4
0
 def test_return_true_if_file_exists(self):
     self.assertTrue(env_file.GhostFile("some_role", "any content").exists)
示例#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"])
示例#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"])