def setUpTestData(cls): cls.test_business = Business.objects.create(business_name='testBiz') create_new_employee({'username': '******', 'password': '******'}) cls.first_slot = ShiftSlot.objects.create(business=cls.test_business, day='1', start_hour='12:00:00', end_hour='13:00:00', constraints='{}')
def setUpTestData(cls): create_manager_and_employee_groups() cls.broadcast_msg = { 'subject': 'broadcast_subject', 'text': 'broadcast_text' } create_new_manager(cls.manager_credentials) create_new_employee(cls.emp_credentials)
def setUpTestData(cls): create_new_manager({'username': '******', 'password': '******'}) cls.test_business = Business.objects.create(business_name='testBiz') cls.emp = create_new_employee(cls.first_emp_credentials) cls.other_emp = create_new_employee(cls.second_emp_credentials) cls.first_slot = ShiftSlot.objects.create(business=cls.test_business, day='1', start_hour='12:00:00', end_hour='13:00:00', constraints='{}') cls.second_slot = ShiftSlot.objects.create(business=cls.test_business, day='1', start_hour='16:00:00', end_hour='18:00:00', constraints='{}')
def setUpTestData(cls): cls.waiter = create_new_employee({ 'username': '******', 'password': '******' }, 'WA') cls.bartender = create_new_employee( { 'username': '******', 'password': '******' }, 'BT') cls.cook = create_new_employee({ 'username': '******', 'password': '******' }, 'CO') cls.business = Business.objects.get(business_name='dummy')
def setUp(self): for role in ['waiter', 'bartender', 'cook']: for field in ['gender', 'age', 'average_rate', 'months_working']: self.dummy_slot[role + '_' + field + '__value_constraint'] = '' self.dummy_slot[role + '_' + field + '__applyOn_constraint'] = '' self.dummy_slot[role + '_' + field + '__operation_constraint'] = '' self.emp_credentials = {'username': '******', 'password': '******'} create_new_employee(self.emp_credentials) test_emp = EmployeeProfile.objects.get( user__username=self.emp_credentials['username']) test_emp.gender = 'M' test_emp.role = 'WA' test_emp.birth_date = datetime.date(1994, 1, 1) test_emp.save()
def setUpTestData(cls): create_new_manager({'username': '******', 'password': '******'}) cls.emp = create_new_employee({ 'username': '******', 'password': '******' }) cls.next_week_num = get_next_week_num() cls.slot = ShiftSlot.objects.create( business=Business.objects.get(business_name='dummy'), week=cls.next_week_num, day='3', start_hour='12:00:00', end_hour='13:00:00')
def test_should_generate_successfully_with_only_first_waiter(self): another_waiter = create_new_employee( { 'username': '******', 'password': '******' }, 'WA') num_of_slots = 3 slots = create_slots_for_next_week(business=self.business, waiter=1, bartender=1, cook=1, num=num_of_slots) NaiveShiftGenerator(slots).generate() self._assert_num_shifts_created(num_of_slots) self.assertEqual( Shift.objects.filter(employees__in=[self.waiter]).count(), num_of_slots) self.assertEqual( Shift.objects.filter(employees__in=[another_waiter]).count(), 0)
def test_should_generate_should_prefer_requester_waiter_when_just_one_slot( self): num_of_slots = 1 another_waiter = create_new_employee( { 'username': '******', 'password': '******' }, 'WA') slots = create_slots_for_next_week(business=self.business, waiter=1, bartender=1, cook=1, num=num_of_slots) self._create_slot_request( slot=slots[0], employees=[self.waiter, self.cook, self.bartender, another_waiter]) ThoughtfulShiftGenerator(slots).generate() self.assertEqual(Shift.objects.count(), num_of_slots) self.assertTrue(self._emp_has_shift(self.waiter)) self.assertFalse(self._emp_has_shift(another_waiter))
def setUpTestData(cls): create_manager_and_employee_groups() create_new_employee(cls.emp1_credentials) create_new_employee(cls.emp2_credentials)
def setUpTestData(cls): create_manager_and_employee_groups() create_new_manager(cls.manager_credentials) create_new_employee(cls.emp_credentials) add_fields_to_slot(cls.dummy_slot)