def list_index(index): """Get list of item types for a specified index. :resheader Content-Type: *application/json* """ item_types = ItemData.get_item_types_by_index(index) if not item_types: abort(404) return jsonify(index=index, item_types=item_types)
def test_list_index(self): item = Item.create() index = 'test' item_data = ItemData.create(item_id=item.id, data_json='{}', data_id='%s/album/lalala' % index) response = self.client.get("/api/1/data/%s" % index) self.assert200(response) self.assertEquals(response.json, dict(index=index, item_types=ItemData.get_item_types_by_index(index))) response = self.client.get("/api/1/data/missing") self.assert404(response)
def list_index(index): item_types = ItemData.get_item_types_by_index(index) if not item_types: abort(404) return render_template('index.html', item_types=item_types, index=index)