コード例 #1
0
 def test_write_a_file(self):
     writer = TextWriter("data to write")
     received = writer.write_received_file("foo")
     self.assertEquals("foo.received.txt", received)
     assert os.path.exists(received)
     with open(received) as f:
         assert "data to write" in f.read()
コード例 #2
0
 def test_write_a_file(self):
     writer = TextWriter("data to write")
     received = writer.write_received_file("foo")
     self.assertEquals("foo.received.txt", received)
     assert os.path.exists(received)
     with open(received) as f:
         assert "data to write" in f.read()
コード例 #3
0
 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)
コード例 #4
0
 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"))
コード例 #5
0
 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)
コード例 #6
0
 def test_approved_filename(self):
     self.assertEquals("foo.approved.txt",
                       TextWriter.approved_filename("foo"))
コード例 #7
0
 def test_received_filename(self):
     self.assertEquals("foo.received.txt",
                       TextWriter.received_filename("foo"))
コード例 #8
0
 def test_approved_filename(self):
     self.assertEquals("foo.approved.txt", TextWriter.approved_filename("foo"))
コード例 #9
0
 def test_received_filename(self):
     self.assertEquals("foo.received.txt", TextWriter.received_filename("foo"))