예제 #1
0
 def test_get_customer_from_invalid_input_file(self):
     """
     Test for invalid customer input file
     :return:
     """
     with self.assertRaises(InvalidFilePathException):
         get_customers(self.invalid_file_path)
예제 #2
0
 def test_get_customers_from_input_file(self):
     """
     Test return type of all customers created by using customer data file
     """
     customers = get_customers(self.file_path)
     self.customers = customers
     for customer in customers:
         self.assertEqual(type(customer), Customer)
예제 #3
0
 def test_get_customers_with_in_radius(self):
     """
     Test return type get_customer_with_in_radius method
     """
     customers = get_customers(self.file_path)
     filter_criteria = FilterCriteria.get_filter(0, self.radius)
     customers = get_customer_within_radius(customers, self.intercom_loc,
                                            filter_criteria)
     for customer in customers:
         self.assertEqual(type(customer), Customer)
예제 #4
0
def write_cursor_to_sheet(sheet: worksheet.Worksheet,
                          cursor: cx_Oracle.Cursor):
    """
    Description: Dumps a prepared cursor into a Excel sheet.
    Parameters
    ----------
    sheet: openpyxl worksheet A sheet to dump it into
    cursor: cx_Oracle cursor prepared with the data
    """

    header = [description[0] for description in cursor.description]
    header.append('Customer No')
    header.append('Customer Name')
    sheet.append(header)
    for row in cursor:
        customer_details = main.get_customers(row[-1])
        lst = list(row)
        lst.append(customer_details[0])
        lst.append(customer_details[1])
        sheet.append(lst)
예제 #5
0
import main

print(main.get_customers('SH20000770'))