Beispiel #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
Beispiel #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
Beispiel #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
Beispiel #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
Beispiel #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
Beispiel #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