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", }), )
def test_return_True_after_write(self): ghost_file = env_file.GhostFile("some_role") ghost_file.write("any content") self.assertTrue(ghost_file.exists)
def test_return_False_if_file_exists(self): self.assertFalse(env_file.GhostFile("some_role").exists)
def test_return_true_if_file_exists(self): self.assertTrue(env_file.GhostFile("some_role", "any content").exists)
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"])
def test_is_not_binary_default(self): ghost_file = env_file.GhostFile("some role", content=None) self.assertFalse(ghost_file.export()["is_binary"])