Exemplo 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
Exemplo 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
Exemplo 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
Exemplo 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
Exemplo 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
Exemplo 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