def test_returns_error_when_files_are_different(self):
     namer = Namer()
     writer = StringWriter("b")
     reporter = TestingReporter()
     approver = FileApprover()
     error = approver.verify(namer, writer, reporter)
     self.assertEqual("Approval Mismatch", error)
 def test_returns_none_when_files_are_same_files(self):
     namer = Namer()
     writer = StringWriter("b")
     reporter = ReceivedFileLauncherReporter()
     approver = FileApprover()
     error = approver.verify(namer, writer, reporter)
     self.assertEqual(None, error)
Exemplo n.º 3
0
 def test_returns_none_when_files_are_same_files(self):
     namer = Namer()
     writer = StringWriter("b")
     reporter = GenericDiffReporterFactory().get_first_working()
     approver = FileApprover()
     error = approver.verify(namer, writer, reporter)
     self.assertEqual(None, error)
 def test_full(self):
     namer = Namer()
     writer = StringWriter("b")
     reporter = TestingReporter()
     approver = FileApprover()
     approver.verify(namer, writer, reporter)
     self.assertTrue(reporter.called)
Exemplo n.º 5
0
 def test_returns_error_when_files_are_different(self):
     namer = Namer()
     writer = StringWriter("b")
     reporter = TestingReporter()
     approver = FileApprover()
     error = approver.verify(namer, writer, reporter)
     self.assertEqual("Approval Mismatch", error)
Exemplo n.º 6
0
 def test_full(self):
     namer = Namer()
     writer = StringWriter("b")
     reporter = TestingReporter()
     approver = FileApprover()
     approver.verify(namer, writer, reporter)
     self.assertTrue(reporter.called)
def verify(data, reporter=ReceivedFileLauncherReporter()):
    approver = FileApprover()
    namer = Namer(2)
    writer = StringWriter(data)

    error = approver.verify(namer, writer, reporter)
    if error is not None:
        raise ApprovalException(error)
Exemplo n.º 8
0
def verify(data, reporter=None):
    if reporter is None:
        reporter = get_default_reporter()
    approver = FileApprover()
    namer = get_default_namer()
    writer = StringWriter(data)

    error = approver.verify(namer, writer, reporter)
    if error is not None:
        raise ApprovalException(error)
Exemplo n.º 9
0
def verify(data, reporter=None):
    if reporter is None:
        reporter = get_default_reporter()
    approver = FileApprover()
    namer = get_default_namer()
    writer = StringWriter(data)

    error = approver.verify(namer, writer, reporter)
    if error is not None:
        raise ApprovalException(error)
 def test_compare_different_files(self):
     approver = FileApprover()
     reporter = TestingReporter()
     approver.verify_files("a.txt", "b.txt", reporter)
     self.assertTrue(reporter.called)
 def test_compare_same_files():
     approver = FileApprover()
     writer = StringWriter("a")
     writer.write_received_file("a.txt")
     shutil.copy("a.txt", "a_same.txt")
     approver.verify_files("a.txt", "a_same.txt", None)
Exemplo n.º 12
0
 def test_compare_different_files(self):
     approver = FileApprover()
     reporter = TestingReporter()
     approver.verify_files("a.txt", "b.txt", reporter)
     self.assertTrue(reporter.called)
Exemplo n.º 13
0
 def test_compare_same_files():
     approver = FileApprover()
     writer = StringWriter("a")
     writer.write_received_file("a.txt")
     shutil.copy("a.txt", "a_same.txt")
     approver.verify_files("a.txt", "a_same.txt", None)