Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_returns_error_when_files_are_different(self):
namer = get_default_namer()
writer = StringWriter("b")
reporter = ReporterForTesting()
approver = FileApprover()
error = approver.verify(namer, writer, reporter)
self.assertEqual("Approval Mismatch", error)
def test_compare_different_files(self):
approver = FileApprover()
reporter = ReporterForTesting()
approver.verify_files("a.txt", "b.txt", reporter)
self.assertTrue(reporter.called)
def setUp(self):
self.reporter = ReporterForTesting()
self.reporter = CommandLineReporter()
self.func = lambda *args: sum(args) + 1
def test_assert_against_file_fails_with_reporter(self):
reporter = ReporterForTesting()
file_path = get_adjacent_file("manual_file.approved.txt")
try:
assert_against_file("This text is NOT in a file", file_path, reporter )
except ApprovalException:
pass
self.assertTrue(reporter.called)
def test_full(self):
namer = get_default_namer()
writer = StringWriter("b")
reporter = ReporterForTesting()
approver = FileApprover()
approver.verify(namer, writer, reporter)
self.assertTrue(reporter.called)
def setUp(self):
self.reporter = ReporterForTesting()
self.func = lambda *args: sum(args) + 1
def test_verify_fail(self):
reporter = ReporterForTesting()
try:
verify("Hello World.", reporter)
self.assertFalse(True, "expected exception")
except ApprovalException as e:
self.assertTrue("Approval Mismatch", e.value)