Exemplo n.º 1
0
def browse_orgs():
    data = controllers.getAllOrgNamesJSON(db)
    memberData = controllers.getMemberDataJSON(db, current_user.get_id())
    if request.method == 'GET' and is_request_json():
        return Response(response=data, status=200, mimetype='application/json')
    else:
        return render_template('browse_orgs.html', data=json.loads(data), memberData=json.loads(memberData))
Exemplo n.º 2
0
    def test_getAllOrgNamesJSON(self):
        ''' Test that we are getting JSON object containing org names and IDs '''
        allOrgs = json.loads(controllers.getAllOrgNamesJSON(self.db))

        ''' First Org should be Ai-Kon with ID 1 '''
        self.assertEqual(allOrgs['OrgNames'][0]['org_name'], 'Ai-Kon')
        self.assertEqual(allOrgs['OrgNames'][0]['org_entityfk'], 1)

        ''' Second Org should be University of Manitoba with ID 2 '''
        self.assertEqual(allOrgs['OrgNames'][1]['org_name'], 'University of Manitoba')
        self.assertEqual(allOrgs['OrgNames'][1]['org_entityfk'], 2)