예제 #1
0
    def test_add_customer(self):
        # tester add client
        customer.Customer("said", "0728782787")
        customer.Customer("tim", "07287568688")
        customer.Customer("said", "0728782787")

        print "========================= list customers ========================="
        print customer.Customer.customers
        print "\n"
예제 #2
0
    def test_take_two_customers(self):
        sample_teller = t.Teller()
        sample_bank = b.Bank()

        sample_cust1 = c.Customer(sample_bank)
        sample_cust2 = c.Customer(sample_bank)

        sample_teller.take_customer(sample_cust1)
        with pytest.raises(Exception) as exception_info:
            sample_teller.take_customer(sample_cust2)
예제 #3
0
    def test_id_increments(self):
        sample_bank = b.Bank()
        cust = c.Customer(sample_bank)
        departure1 = e.CustomerDepartureEvent(1, cust)
        departure2 = e.CustomerDepartureEvent(1, cust)

        assert departure2.get_id() == departure1.get_id() + 1
예제 #4
0
    def test_id_increments(self):
        sample_bank = b.Bank()
        cust = c.Customer(sample_bank)
        arrival1 = e.CustomerArrivalEvent(1, cust)
        arrival2 = e.CustomerArrivalEvent(1, cust)

        assert arrival2.get_id() == arrival1.get_id() + 1
예제 #5
0
 def __init__(self):
     self.title = None
     self.author_name = None
     self.author_surname = None
     self.price = None
     self.buyer_pesel = customer.Customer(
     ).pesel  # earlier was self.buyer = customer.Customer()
예제 #6
0
def readFile(name):
    with open(name) as fd:
        N,M,C,R=fd.readline().split()
        N,M,C,R=int(N),int(M),int(C),int(R)
        customers=[]
        map=[]
        for i in range(C):
            col, row, reward=fd.readline().split()
            row, col, reward = int(row),int(col),int(reward)
            customers.append(customer.Customer(row,col,reward))
        for i in range(M):
            l=list(fd.readline())
            map_list=[]
            for j in range(N):
                c=cell.Cell(l[j])
                map_list.append(c)
            map.append(map_list)
    param = {}
    param['N'] = N
    param['M'] = M
    param['C'] = C
    param['R'] = R


    return customers,map, param
예제 #7
0
    def start_app(self):
        i=0
        test=tester.Tester.hotels
        while i< len(test):
            new_hotel=hotel.Hotel(test[i][0],test[i][1],test[i][2],test[i][3],test[i][4])
            i+=1


        ################################
        #check if there is empty room in a hotels_list

        x=0
        test_reservation=tester.Tester.reservation
        while x< len(test_reservation):
            hotel_name=test_reservation[x][0]
            customer_name=test_reservation[x][1]
            mobile_number=test_reservation[x][2]
            if new_hotel.get_no_empty_rooms(hotel_name)>0:
                new_reservation=reservation.Reservation(hotel_name,customer_name,mobile_number)
                new_hotel.update_empty_rooms(hotel_name,new_hotel.get_no_empty_rooms(hotel_name)-1)

            #confirmation message
                message="thank you {}\n you reserve in {}\n date: {}".format(customer_name,hotel_name,datetime.datetime.now().strftime("%a, %d %B %Y %I:%M:%S"))
            #send confirmation message to customer
                new_notification=notification.Notification()
                new_notification.send_sms(mobile_number,message)
                # new_notification=notification.Notification(mobile_number,message)
            #add to customers list
                new_customer=customer.Customer(customer_name,mobile_number)


            else:
                print "no reservation available"
            x+=1
예제 #8
0
 def __init__(self):
     self.number = 0
     self.hotel_name = ""
     self.city = ""
     self.total_rooms = 0
     self.empty_rooms = 0
     self.customer = customer.Customer()
예제 #9
0
    def test_check_nutritional_inconsistencies__empty(self):
        new_customer = sf.Customer()

        result = nelly.check_nutritional_inconsistencies(customer=new_customer)
        expected = {}

        self.assertEqual(expected, result)
예제 #10
0
    def handleLogin(self):
        # manufacturer
        if (self.textName.text() == 'Manu' and self.textPass.text() == '1111'):
            self.accept()
            self.manufacturer = manufact.Manufacturer()

        # dealership
        elif (self.textName.text() == 'Deal'
              and self.textPass.text() == '2222'):
            self.accept()
            self.dealership = deal.Dealership()

        # customer
        elif (self.textName.text() == 'Cust'
              and self.textPass.text() == '3333'):
            self.accept()
            self.customer = cust.Customer()

        # repair shop
        elif (self.textName.text() == 'Repair'
              and self.textPass.text() == '4444'):
            self.accept()
            self.repairshop = repair.Repairshop()
        else:
            QtWidgets.QMessageBox.warning(self, 'Error',
                                          'Bad user or password')


# Register User screen - todo for later
def getRegistered():
    userid = input("Enter the username: "******"Username cannot be empty!!")
        return
    password = getpass.getpass("Enter the password: "******"Password cannot be empty!!")
        return
    name = input("Enter your full name: ")
    if name == None or name == '':
        print("Name cannot be empty!!")
        return
    address = input("Enter your full address: ")
    phone = input("Enter phone number: ")

    for cust in dataLists.custList:
        if cust.userId == userid:
            print(
                "Another user with same userid is present in the system!! Please choose a different userid"
            )
            return None
    newCust = customer.Customer(userid, password, name, address, phone)
    dataLists.custList.append(newCust)
    return newCust
예제 #12
0
    def test_teller_event_published(self):
        sample_bank = b.Bank()
        cust = c.Customer(sample_bank)
        sample_teller = t.Teller()
        sample_bank.save_event = MagicMock()
        cust.go_to_teller(sample_teller)

        assert sample_bank.save_event.called
예제 #13
0
    def test_update_customer_with_greeting__updated_info_is_correct(self):
        new_customer = sf.Customer()

        nelly.update_customer_with_greeting(customer=new_customer)
        result = new_customer.last_state_change
        expected = {'semantic_frames': ['greeting'], 'state_changed': {'number_of_greetings': 1}}

        self.assertEqual(expected, result)
예제 #14
0
 def test_longer_service_time_false(self):
     sample_bank = b.Bank()
     sample_bank.get_time = MagicMock(return_value=1)
     cust = c.Customer(sample_bank, 2)
     sample_teller = t.Teller()
     sample_bank.get_time = MagicMock(return_value=2)
     cust.go_to_teller(sample_teller)
     assert ~cust.accept_teller_service()
예제 #15
0
    def test_id_increments(self):
        sample_bank = b.Bank()
        cust = c.Customer(sample_bank)
        tell = t.Teller()
        service1 = e.CustomerServiceEvent(1, cust, tell)
        service2 = e.CustomerServiceEvent(1, cust, tell)

        assert service2.get_id() == service1.get_id() + 1
예제 #16
0
    def test_service_customer_with_two_turns_once(self):
        sample_teller = t.Teller()
        sample_bank = b.Bank()
        sample_cust = c.Customer(sample_bank, 2)

        sample_teller.take_customer(sample_cust)
        sample_teller.work_one_turn()

        assert sample_teller.has_customer()
예제 #17
0
    def test_time_reached_teller(self):
        sample_bank = b.Bank()
        cust = c.Customer(sample_bank)

        sample_teller = t.Teller()
        sample_bank.get_time = MagicMock(return_value=2)
        cust.go_to_teller(sample_teller)

        assert cust.get_time_reached_teller() == 2
예제 #18
0
    def test_update_order_with_request__pita_bread(self):
        new_customer = sf.Customer()
        parsed_tree = nlp("can I have pita bread")

        nelly.update_order_with_request(
            customer=new_customer, parsed_tree=parsed_tree)
        expected_bread = "pita_bread"

        self.assertEqual(expected_bread, new_customer.order.bread_type)
예제 #19
0
    def test_triggers_a_request_special_need(self):
        new_customer = sf.Customer()

        parsed_tree = nlp("i am vegan and vegetarian")
        nelly.update_state(customer=new_customer, parsed_tree=parsed_tree)

        results_list = new_customer.food_restrictions_list
        expected_list = ["vegan", "vegetarian"]

        self.assertEqual(expected_list, results_list)
예제 #20
0
    def test_adding_vegetables(self):
        new_customer = sf.Customer()
        new_customer.order.add_vegetable("tomato")
        new_customer.order.add_vegetable("lettuce")
        new_customer.order.add_vegetable("olives")
        new_customer.order.add_vegetable("onions")

        result = new_customer.order.vegetable_list
        expected = ["tomato", "lettuce", "olives","onions"]
        self.assertEqual(expected, result)
예제 #21
0
    def test_check_update_order_with_removal_request_sauces_that_does_not_exist(self):
        new_customer = sf.Customer()
        new_customer.order.add_sauce("ketchup")
        parsed_tree = nlp("Nelly, please remove mustard")

        nelly.update_order_with_removal_request(customer=new_customer, parsed_tree=parsed_tree)

        result = new_customer.sauce_list = ["mustard"]

        self.assertTrue(result)
예제 #22
0
    def test_update_order_with_request_ignore_food_type__cheese(self):
        new_customer = sf.Customer()
        question_context = {'type':'cheese'}

        nelly.update_order_with_request_ignore_food_type(
            customer=new_customer, question_context=question_context)
        expected_wants_food_type = {
            'cheese': False, 'protein': True, 'sauce': True, 'vegetable': True}

        self.assertEqual(expected_wants_food_type, new_customer.order.wants_food_type)
예제 #23
0
    def test_triggers_a_request_order_update_for_bread(self):
        new_customer = sf.Customer()

        parsed_tree = nlp("I want a sandwich with whole wheat bread")
        nelly.update_state(customer=new_customer, parsed_tree=parsed_tree)

        results = new_customer.order.bread_type
        expected = "whole_wheat_bread"

        self.assertEqual(expected, results)
예제 #24
0
    def test_update_order_with_request__check_feedback(self):
        new_customer = sf.Customer()
        new_customer.food_restrictions_list = ['vegan']
        parsed_tree = nlp("I want a sandwich with whole wheat bread")

        nelly.update_order_with_request(
            customer=new_customer, parsed_tree=parsed_tree)
        expected_feedback = {'nutritional_violations': ['whole_wheat_bread']}

        self.assertEqual(expected_feedback, new_customer.feedback)
예제 #25
0
    def test_take_customer(self):
        sample_teller = t.Teller()
        sample_bank = b.Bank()
        sample_cust = c.Customer(sample_bank)

        sample_cust.go_to_teller = MagicMock(return_value=1)

        sample_teller.take_customer(sample_cust)

        assert sample_cust.go_to_teller.called
예제 #26
0
    def test_check_update_order_with_removal_request_vegetables(self):
        new_customer = sf.Customer()
        new_customer.order.add_vegetable("tomato")
        new_customer.order.add_vegetable("onion")
        new_customer.order.add_vegetable("lettuce")
        parsed_tree = nlp("Nelly, please remove tomato")

        nelly.update_order_with_removal_request(customer=new_customer, parsed_tree=parsed_tree)

        result = new_customer.vegetable_list = ["onion", "lettuce"]
        self.assertTrue(result)
def get_data():
    name = input('Enter the name of the customer: ')
    address = input('Enter the address of the customer: ')
    number = input('Enter the telephone number: ')
    customer_num = input('Enter the customer number: ')
    mail = int(
        input(
            'Press 1 if the customer wants to be on the mailing list else press 0: '
        ))
    obj = customer.Customer(name, address, number, customer_num, mail)
    return obj
예제 #28
0
    def test_total_time(self):
        sample_bank = b.Bank()
        sample_bank.get_time = MagicMock(return_value=1)
        cust = c.Customer(sample_bank)

        sample_teller = t.Teller()
        sample_bank.get_time = MagicMock(return_value=2)
        cust.go_to_teller(sample_teller)

        cust.accept_teller_service()
        assert cust.get_total_time() == 2
예제 #29
0
def Customer():
    placed = "order placed"
    not_placed = "order not placed"

    print("this is the customer interface")
    name = input("what is your name: ")
    # creating a new Customer object
    new_customer = customer.Customer(name)
    print("Customer Name: ", new_customer.name)

    #calls the ordering system function
    OrderingSystem()
예제 #30
0
    def test_filter_by_type_returns_none(self):
        bank = b.Bank()
        cust = c.Customer(bank)

        e1 = e.CustomerArrivalEvent(1, cust)
        e2 = e.CustomerArrivalEvent(1, cust)
        e_list = [e1, e2]

        rec = er.EventRecord(e_list)

        filtered_rec = rec.filter_by_type(e.CustomerServiceEvent)
        assert filtered_rec.get_event_list() == []