コード例 #1
0
def _build_and_validate_many_customers():
    cid_path = dev_test.CID_CUSTOMERS_ODS_PATH
    # TODO: Write to 'build/many_customers.csv'
    many_customers_csv_path = dev_test.path_to_test_data("lots_of_customers.csv")
    _build_lots_of_customers_csv(many_customers_csv_path, 50)

    # Validate the data using the API, so in case of errors we get specific information.
    customers_cid = interface.Cid(cid_path)
    with validio.Reader(customers_cid, many_customers_csv_path) as reader:
        reader.validate_rows()

    # Validate the data using the command line application in order to use
    # the whole tool chain from an end user's point of view.
    exit_code = applications.main(["test_performance.py", cid_path, many_customers_csv_path])
    if exit_code != 0:
        raise ValueError("exit code of performance test must be 0 but is %d" % exit_code)
コード例 #2
0
def _build_and_validate_many_customers():
    icd_ods_path = dev_test.path_to_test_cid("customers.ods")
    # TODO: Write to 'build/many_customers.csv'
    many_customers_csv_path = dev_test.path_to_test_data(
        "lots_of_customers.csv")
    _build_lots_of_customers_csv(many_customers_csv_path, 50)

    # Validate the data using the API, so in case of errors we get specific information.
    customers_cid = interface.Cid(icd_ods_path)
    with validio.Reader(customers_cid, many_customers_csv_path) as reader:
        reader.validate_rows()

    # Validate the data using the command line application in order to use
    # the whole tool chain from an end user's point of view.
    exit_code = applications.main(
        ["test_performance.py", icd_ods_path, many_customers_csv_path])
    if exit_code != 0:
        raise ValueError("exit code of performance test must be 0 but is %d" %
                         exit_code)
コード例 #3
0
 def test_can_deal_with_non_existent_cid(self):
     self.assertEqual(3, applications.main(['test', 'no_such_file.xxx']))
コード例 #4
0
 def test_can_deal_with_broken_cid(self):
     broken_cid_path = dev_test.path_to_test_cid('broken_syntax_error.ods')
     self.assertEqual(1, applications.main(['test', broken_cid_path]))
コード例 #5
0
 def test_can_deal_with_broken_data(self):
     cid_path = dev_test.path_to_test_cid('customers.ods')
     data_path = dev_test.path_to_test_data('broken_customers.csv')
     self.assertEqual(1, applications.main(['test', cid_path, data_path]))
コード例 #6
0
 def test_can_validate_proper_data(self):
     cid_path = dev_test.path_to_test_cid('customers.ods')
     data_path = dev_test.path_to_test_data('valid_customers.csv')
     self.assertEqual(0, applications.main(['test', cid_path, data_path]))
コード例 #7
0
 def test_can_read_cid(self):
     cid_path = dev_test.path_to_test_cid('customers.ods')
     self.assertEqual(0, applications.main(['test', cid_path]))
コード例 #8
0
 def test_can_deal_with_non_existent_data(self):
     self.assertEqual(
         3,
         applications.main(
             ['test', _customers_cid_path, 'no_such_data.xxx']))
コード例 #9
0
 def test_can_validate_proper_data(self):
     self.assertEqual(0, applications.main(['test', _customers_cid_path, _valid_customers_csv_path]))
コード例 #10
0
 def test_can_read_cid(self):
     self.assertEqual(0, applications.main(['test', _customers_cid_path]))
コード例 #11
0
 def _test_fails_with_system_exit(self, expected_code, argv):
     try:
         applications.main(argv)
         self.fail()
     except SystemExit as anticipated_error:
         self.assertEqual(expected_code, anticipated_error.code)
コード例 #12
0
 def test_can_deal_with_non_existent_data(self):
     self.assertEqual(3, applications.main(['test', _customers_cid_path, 'no_such_data.xxx']))
コード例 #13
0
 def test_can_deal_with_non_existent_cid(self):
     self.assertEqual(3, applications.main(['test', 'no_such_cid.xxx']))
コード例 #14
0
 def test_can_deal_with_broken_cid(self):
     broken_cid_path = dev_test.path_to_test_cid('broken_syntax_error.ods')
     self.assertEqual(1, applications.main(['test', broken_cid_path]))
コード例 #15
0
 def test_can_deal_with_broken_data(self):
     data_path = dev_test.path_to_test_data('broken_customers.csv')
     self.assertEqual(1, applications.main(['test', _customers_cid_path, data_path]))
コード例 #16
0
 def _test_fails_with_system_exit(self, expected_code, argv):
     try:
         applications.main(argv)
         self.fail()
     except SystemExit as anticipated_error:
         self.assertEqual(expected_code, anticipated_error.code)
コード例 #17
0
 def test_can_validate_proper_data(self):
     self.assertEqual(
         0,
         applications.main(
             ['test', _customers_cid_path, _valid_customers_csv_path]))
コード例 #18
0
 def test_can_read_cid(self):
     self.assertEqual(0, applications.main(['test', _customers_cid_path]))