def test_getPeopleByShiftJSON_false(self):
     key = 999
     shiftPersonListJSON = shiftperson_controller.getPeopleByShiftJSON(key)
     shiftPersonListDict = json.loads(shiftPersonListJSON)
     for rootKey, rootVal in shiftPersonListDict.iteritems():
         self.assertEqual(rootKey, 'Workers')
         self.assertEqual(rootVal, 'None')
Esempio n. 2
0
def getPersonsByOrgEventShift(org_id, event_id, shift_id):
    try:

        shiftPersonJSON = shiftperson_controller.getPeopleByShiftJSON(shift_id)
        shiftPersonDict = json.loads(shiftPersonJSON)
        if is_request_json():
            return jsonify(shiftPersonDict, event_id=event_id, shift_id=shift_id)
            
    except Exception, e:
        return abort(404)
 def test_getPeopleByShiftJSON_true(self):
     key = 1
     shiftPersonListJSON = shiftperson_controller.getPeopleByShiftJSON(key)
     shiftPersonListDict = json.loads(shiftPersonListJSON)
     for rootKey, rootVal in shiftPersonListDict.iteritems():
         self.assertEqual(rootKey, 'Workers')
         counter = 0
         for personJSON in rootVal:
             person = controllers.extractEmployeeFromDict(personJSON)
             if person.entityFK == 3:
                 counter += 1
                 self.assertEqual(person.firstname, 'Chris')
                 self.assertEqual(person.lastname, 'Workman')
             elif person.entityFK == 4:
                 counter += 1
                 self.assertEqual(person.firstname, 'Ryoji')
                 self.assertEqual(person.lastname, 'Betchaku')
         self.assertEqual(counter, 2)