Пример #1
0
 def test_customer_creation(self):
     # Save
     original_customer_count = Customer.objects.count()
     
     wl = WaitList(restaurant=self.restaurant); wl.save()
     c = Customer(name="Fred", party_size=5, phone="0000000000", waitlist=wl)
     c = save_load(c)
     self.assertEqual(Customer.objects.count(), original_customer_count+1)
     self.assertNotEqual(c, None)
     self.assertEqual(c.name, "Fred")
     self.assertEqual(c.party_size, 5)
     self.assertEqual(c.phone, "0000000000")
Пример #2
0
 def setUp(self):
     self.user = User.objects.create_user("TestAddTest_User")
     self.restaurant = Restaurant(name="Slippery Bannana", 
                          contactinfo="123 Fake Street",
                          qrfile="nonexistent qrfile",
                          client_gmt_offset=1);
     self.restaurant.save()
     wl = WaitList(restaurant=self.restaurant); 
     wl.save()
     self.user.restaurantAdminUser = RestaurantAdmin(nick="TestAddTest_nick",
                                                     restaurant=self.restaurant) 
     self.request = HttpRequest()
     self.request.user = self.user
Пример #3
0
 def setUp(self):
     '''Add user data so we have something to archive'''
     self.user = User.objects.create_user("TestAddTest_User")
     self.restaurant = Restaurant(name="Slippery Bannana", 
                          contactinfo="123 Fake Street",
                          qrfile="nonexistent qrfile",
                          client_gmt_offset=1);
     self.restaurant.save()
     wl = WaitList(restaurant=self.restaurant); 
     wl.save()
     self.user.restaurantAdminUser = RestaurantAdmin(nick="TestAddTest_nick",
                                                     restaurant=self.restaurant) 
     self.request = HttpRequest()
     self.request.user = self.user
     views.test_add(self.request, 3, 7, "checkedin_removed")
Пример #4
0
 def setUp(self):
     self.user = User.objects.create_user('CustomerTest_User')
     self.restaurant = Restaurant.objects.create(name="Slippery Bannana", 
                                  contactinfo="123 Fake Street",
                                  email_message="[CUSTOMER],\nYour take-our order from Slipper Bannna is read. Please come pick it up.\nThanks,\nSlipper Bannana",
                                  email_subject="Your Take-out Is Ready",
                                  email_from="*****@*****.**",
                                  qrfile="nonexistent qrfile",
                                  client_gmt_offset=1);
     self.user.restaurantAdminUser = RestaurantAdmin(nick="TestAddTest_nick",
                                                     restaurant=self.restaurant) 
     wl = WaitList(restaurant=self.restaurant); wl.save()
     self.customer = Customer.objects.create(name="Fred", party_size=5, phone="0000000000", waitlist=wl, email="*****@*****.**")
     self.request = HttpRequest()
     self.request.user = self.user
     self.request.GET['customer_id'] = str(self.customer.id) 
     self.request.session = {}
Пример #5
0
 def test_add_customer(self):
     wl = WaitList(restaurant=self.restaurant); 
     wl.save()
     wl.add_customer(Customer(name="Fred", party_size=5, phone="0000000000", waitlist=wl))
     wl.add_customer(Customer(name="George", party_size=2, phone="0000000000", waitlist=wl))
     wl = save_load(wl);
     self.assertEqual(wl.customers.count(), 2)
     self.assertEqual(wl.customers.filter(name="Fred").count(), 1)
     self.assertEqual(wl.customers.filter(name="George").count(), 1)