'Test the ajax asset interfaces'

def test_json_responses(self):

    self.upload_asset('asset-1')
    self.upload_asset('asset-2')
    self.upload_asset('asset-3')
    self.upload_asset('asset-4', 'opendoc')
    self.assert_correct_asset_response(self.url, 0, 4, 4)
    self.assert_correct_asset_response((self.url + '?page_size=2'), 0, 2, 4)
    self.assert_correct_asset_response((self.url + '?page_size=2&page=1'), 2, 2, 4)
    self.assert_correct_sort_response(self.url, 'date_added', 'asc')
    self.assert_correct_sort_response(self.url, 'date_added', 'desc')
    self.assert_correct_sort_response(self.url, 'display_name', 'asc')
    self.assert_correct_sort_response(self.url, 'display_name', 'desc')
    self.assert_correct_filter_response(self.url, 'asset_type', '')
    self.assert_correct_filter_response(self.url, 'asset_type', 'OTHER')
    self.assert_correct_filter_response(self.url, 'asset_type', 'Documents')
    self.assert_correct_asset_response((self.url + '?page_size=2&page=-1'), 0, 2, 4)
    self.assert_correct_asset_response((self.url + '?page_size=2&page=2'), 2, 2, 4)
    self.assert_correct_asset_response((self.url + '?page_size=3&page=1'), 3, 1, 4)
