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, Options().comparator)
def test_writes_file(tmpdir): contents = "foo" + str(randint(0, 100)) sw = StringWriter(contents) filename = os.path.join(str(tmpdir), 'stuff.txt') sw.write_received_file(filename) with open(filename, 'r') as received: assert contents == received.read()
def test_writes_file_to_missing_directory(tmpdir): contents = "foo" sw = StringWriter(contents) filename = os.path.join(str(tmpdir), 'non_existent_folder', './stuff.txt') sw.write_received_file(filename) with open(filename, 'r') as received: assert contents == received.read()
def test_writes_file(self): contents = "foo" + str(randint(0, 100)) sw = StringWriter(contents) filename = './stuff.txt' sw.write_received_file(filename) with open(filename, 'r') as received: self.assertEqual(contents, received.read()) os.remove(filename)
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)