def test_missing_golden_master(self): writer = TextWriter("file contents") namer = SimpleNamer("foo", os.getcwd()) approver = FileApprover(writer, namer) self.assertFalse(approver.approve()) self.assertTrue(os.path.exists("foo.received.txt")) self.assertIsNotNone(approver.failure)
def test_approve_passing(self): writer = TextWriter("file contents") namer = SimpleNamer("foo", os.getcwd()) approver = FileApprover(writer, namer) with open("foo.approved.txt", "w") as f: f.write("file contents") self.assertTrue(approver.approve()) self.assertFalse(os.path.exists("foo.received.txt"))
def test_approve_with_a_diff(self): writer = TextWriter("file contents") namer = SimpleNamer("foo", os.getcwd()) approver = FileApprover(writer, namer) with open("foo.approved.txt", "w") as f: f.write("file contents changed") self.assertFalse(approver.approve()) self.assertTrue(os.path.exists("foo.received.txt")) self.assertIsNotNone(approver.failure)