Пример #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]))