Esempio n. 1
0
 def testCanSniffAndValidateUsingMainWithHeaderAndEncoding(self):
     testIcdPath = dev_test.getTestOutputPath("icd_sniffed_valid_customers_with_header_iso-8859-15.csv")
     testDataPath = dev_test.getTestInputPath("valid_customers_with_header_iso-8859-15.csv")
     exitCode = _cutsniff.main(["test", "--data-encoding", "iso-8859-15", "--head", "1", testIcdPath, testDataPath])
     self.assertEqual(exitCode, 0)
     sniffedIcd = interface.InterfaceControlDocument()
     sniffedIcd.read(testIcdPath)
     for _ in interface.validatedRows(sniffedIcd, testDataPath):
         pass
Esempio n. 2
0
 def testCanSniffAndValidateUsingMain(self):
     testIcdPath = dev_test.getTestOutputPath("icd_sniffed_valid_customers.csv")
     testDataPath = dev_test.getTestInputPath("valid_customers.csv")
     exitCode = _cutsniff.main(["test", testIcdPath, testDataPath])
     self.assertEqual(exitCode, 0)
     sniffedIcd = interface.InterfaceControlDocument()
     sniffedIcd.read(testIcdPath)
     for _ in interface.validatedRows(sniffedIcd, testDataPath):
         pass
Esempio n. 3
0
 def testCanSniffAndValidateUsingMain(self):
     testIcdPath = dev_test.getTestOutputPath(
         "icd_sniffed_valid_customers.csv")
     testDataPath = dev_test.getTestInputPath("valid_customers.csv")
     exitCode = _cutsniff.main(["test", testIcdPath, testDataPath])
     self.assertEqual(exitCode, 0)
     sniffedIcd = interface.InterfaceControlDocument()
     sniffedIcd.read(testIcdPath)
     for _ in interface.validatedRows(sniffedIcd, testDataPath):
         pass
Esempio n. 4
0
 def testCanSniffAndValidateUsingMainWithHeaderAndEncoding(self):
     testIcdPath = dev_test.getTestOutputPath(
         "icd_sniffed_valid_customers_with_header_iso-8859-15.csv")
     testDataPath = dev_test.getTestInputPath(
         "valid_customers_with_header_iso-8859-15.csv")
     exitCode = _cutsniff.main([
         "test", "--data-encoding", "iso-8859-15", "--head", "1",
         testIcdPath, testDataPath
     ])
     self.assertEqual(exitCode, 0)
     sniffedIcd = interface.InterfaceControlDocument()
     sniffedIcd.read(testIcdPath)
     for _ in interface.validatedRows(sniffedIcd, testDataPath):
         pass
Esempio n. 5
0
 def testCanSniffAndValidateUsingMainWithFieldNames(self):
     testIcdPath = dev_test.getTestOutputPath(
         "icd_sniffed_valid_customers.csv")
     testDataPath = dev_test.getTestInputPath("valid_customers.csv")
     exitCode = _cutsniff.main([
         "test", "--names",
         " branchId,customerId, firstName,surName ,gender,dateOfBirth ",
         testIcdPath, testDataPath
     ])
     self.assertEqual(exitCode, 0)
     sniffedIcd = interface.InterfaceControlDocument()
     sniffedIcd.read(testIcdPath)
     self.assertEqual(sniffedIcd.fieldNames, [
         "branchId", "customerId", "firstName", "surName", "gender",
         "dateOfBirth"
     ])
     for _ in interface.validatedRows(sniffedIcd, testDataPath):
         pass
Esempio n. 6
0
 def testCanSniffAndValidateUsingMainWithFieldNames(self):
     testIcdPath = dev_test.getTestOutputPath("icd_sniffed_valid_customers.csv")
     testDataPath = dev_test.getTestInputPath("valid_customers.csv")
     exitCode = _cutsniff.main(
         [
             "test",
             "--names",
             " branchId,customerId, firstName,surName ,gender,dateOfBirth ",
             testIcdPath,
             testDataPath,
         ]
     )
     self.assertEqual(exitCode, 0)
     sniffedIcd = interface.InterfaceControlDocument()
     sniffedIcd.read(testIcdPath)
     self.assertEqual(
         sniffedIcd.fieldNames, ["branchId", "customerId", "firstName", "surName", "gender", "dateOfBirth"]
     )
     for _ in interface.validatedRows(sniffedIcd, testDataPath):
         pass
Esempio n. 7
0
 def testBrokenSheet(self):
     testInPath = dev_test.getTestInputPath("valid_customers.ods")
     testOutPath = dev_test.getTestOutputPath("valid_customers_from__ods.csv")
     self.assertRaises(SystemExit, _ods.main, ["--sheet=x", testInPath, testOutPath])
     self.assertRaises(SystemExit, _ods.main, ["--sheet=0", testInPath, testOutPath])
Esempio n. 8
0
 def testBrokenKinkyFileName(self):
     testInPath = dev_test.getTestInputPath("valid_customers.ods")
     testOutPath = dev_test.getTestOutputPath("kinky_file_name//\\:^$\\::/")
     self.assertRaises(SystemExit, _ods.main, [testInPath, testOutPath])
Esempio n. 9
0
 def testConvertToRst(self):
     testInPath = dev_test.getTestInputPath("valid_customers.ods")
     testOutPath = dev_test.getTestOutputPath("valid_customers_from__ods.rst")
     _ods.main(["--format=rst", testInPath, testOutPath])
Esempio n. 10
0
 def testConvertToDocBook(self):
     testInPath = dev_test.getTestInputPath("valid_customers.ods")
     testOutPath = dev_test.getTestOutputPath("valid_customers_from__ods.xml")
     _ods.main(["--format=docbook", testInPath, testOutPath])
Esempio n. 11
0
 def testConvertToCsv(self):
     testInPath = dev_test.getTestInputPath("valid_customers.ods")
     testOutPath = dev_test.getTestOutputPath("valid_customers_from__ods.csv")
     _ods.main([testInPath, testOutPath])