Esempio n. 1
0
 def test_generic_list_view_calls_search_generic_with_supplied_args_dict(
         self, tv_search_generic):
     tv_search_generic.return_value = {}
     resp_object = tv.generic_list_view(
         document_type='something', args_dict={'detroit': 'grand_poobahs'})
     tv.search_generic.assert_called_once_with(
         document_type='something', args_dict={'detroit': 'grand_poobahs'})
Esempio n. 2
0
    def test_generic_list_view_catches_exceptions(self, tv_search_generic):

        tv_search_generic.side_effect = ThermalBaseError('phenomenon')

        resp_object = tv.generic_list_view(document_type='picture')
        assert resp_object.data == '"phenomenon"'
        assert resp_object.status_code == 400
Esempio n. 3
0
def list_groups():
    '''
    Lists all groups
    Includes paging and searching on any field in the group document
    '''
    # If no settings or groups yet create a group
    group_dict = get_group_document('current')
    return generic_list_view(document_type='group')
Esempio n. 4
0
def list_groups():
    '''
    Lists all groups
    Includes paging and searching on any field in the group document
    '''
    # If no settings or groups yet create a group
    group_dict = get_group_document('current')
    return generic_list_view(document_type='group')
Esempio n. 5
0
    def test_generic_list_view_catches_exceptions(self,
                                                  tv_search_generic):

        tv_search_generic.side_effect = ThermalBaseError('phenomenon')

        resp_object = tv.generic_list_view(document_type='picture')
        assert resp_object.data == '"phenomenon"'
        assert resp_object.status_code == 400
Esempio n. 6
0
 def test_generic_list_view_calls_search_generic(self,
                                                 tv_search_generic):
     tv_search_generic.return_value = {'1212': {'_id': '1212'},
                                       '2323': {'_id': '2323'}}
     resp_object = tv.generic_list_view(document_type='something')
     tv.search_generic.assert_called_once_with(document_type='something', args_dict={})
     response_data_dict = json.loads(resp_object.data)
     assert resp_object.status_code == 200
     assert '1212' in response_data_dict
     assert '2323' in response_data_dict
     assert len(response_data_dict.keys()) == 2
Esempio n. 7
0
def get_group_gallery(group_id):
    '''
    Fetches the photo gallery for a supplied group id
    Includes paging and searching on any field in the picture document
    '''
    try:
        group_dict = get_group_document(group_id)
        group_id = group_dict['_id']
        return generic_list_view(document_type='picture',
                                 args_dict={'group_id': group_id, 'gallery_url_not_null': True})
    except Exception as e:
        return Response(json.dumps(e.message), status=e.status_code, mimetype='application/json')
Esempio n. 8
0
def get_group_pictures(group_id):
    '''
    Fetches pictures for a supplied group id
    Includes paging and searching on any field in the picture document
    '''
    try:
        group_dict = get_group_document(group_id)
        group_id = group_dict['_id']
        return generic_list_view(document_type='picture',
                                 args_dict={'group_id': group_id})
    except Exception as e:
        return Response(json.dumps(e.message),
                        status=e.status_code,
                        mimetype='application/json')
Esempio n. 9
0
 def test_generic_list_view_calls_search_generic(self, tv_search_generic):
     tv_search_generic.return_value = {
         '1212': {
             '_id': '1212'
         },
         '2323': {
             '_id': '2323'
         }
     }
     resp_object = tv.generic_list_view(document_type='something')
     tv.search_generic.assert_called_once_with(document_type='something',
                                               args_dict={})
     response_data_dict = json.loads(resp_object.data)
     assert resp_object.status_code == 200
     assert '1212' in response_data_dict
     assert '2323' in response_data_dict
     assert len(response_data_dict.keys()) == 2
Esempio n. 10
0
def list_calibration_sessions():
    '''
    Lists all calibration sessions
    Supports paging and filtering on any attribute via get parms
    '''
    return generic_list_view(document_type='calibration_session')
Esempio n. 11
0
def list_calibration_sessions():
    '''
    Lists all calibration sessions
    Supports paging and filtering on any attribute via get parms
    '''
    return generic_list_view(document_type='calibration_session')
Esempio n. 12
0
def list_distortion_pairs():
    '''
    Lists all distortion pairs
    Supports paging and filtering on any attribute via get parms
    '''
    return generic_list_view(document_type='distortion_pair')
Esempio n. 13
0
def list_snaps():
    '''
    Lists all snaps
    Supports paging and filtering on any attribute via get parms
    '''
    return generic_list_view(document_type='snap')
Esempio n. 14
0
 def test_generic_list_view_calls_search_generic_with_supplied_args_dict(self,
                                                                         tv_search_generic):
     tv_search_generic.return_value = {}
     resp_object = tv.generic_list_view(document_type='something', args_dict={'detroit': 'grand_poobahs'})
     tv.search_generic.assert_called_once_with(document_type='something', args_dict={'detroit': 'grand_poobahs'})
Esempio n. 15
0
def list_snaps():
    '''
    Lists all snaps
    Supports paging and filtering on any attribute via get parms
    '''
    return generic_list_view(document_type='snap')
Esempio n. 16
0
def list_distortion_pairs():
    '''
    Lists all distortion pairs
    Supports paging and filtering on any attribute via get parms
    '''
    return generic_list_view(document_type='distortion_pair')
Esempio n. 17
0
def list_pictures():
    '''
    Lists all pictures
    Supports paging and filtering on any picture attribute via get parms
    '''
    return generic_list_view(document_type='picture')
Esempio n. 18
0
def list_pictures():
    '''
    Lists all pictures
    Supports paging and filtering on any picture attribute via get parms
    '''
    return generic_list_view(document_type='picture')