api: don't return agenda internal identifiers (#19266)

This commit is contained in:
Frédéric Péters 2017-10-07 11:38:06 +02:00 committed by Thomas NOEL
parent 6ead030aed
commit 20aa74b697
2 changed files with 6 additions and 6 deletions

View File

@ -88,8 +88,8 @@ def get_all_slots(agenda, meeting_type):
def get_agenda_detail(request, agenda):
agenda_detail = {
'id': agenda.id,
'slug': agenda.slug,
'id': agenda.slug,
'slug': agenda.slug, # kept for compatibility
'text': agenda.label,
'kind': agenda.kind,
}

View File

@ -100,15 +100,15 @@ def test_agendas_api(app, some_data, meetings_agenda):
agenda2 = Agenda.objects.filter(label=u'Foo bar2')[0]
resp = app.get('/api/agenda/')
assert resp.json == {'data': [
{'text': 'Foo bar', 'id': agenda1.id, 'slug': u'foo-bar', 'kind': 'events',
{'text': 'Foo bar', 'id': u'foo-bar', 'slug': 'foo-bar', 'kind': 'events',
'api': {'datetimes_url': 'http://testserver/api/agenda/%s/datetimes/' % agenda1.slug}},
{'text': 'Foo bar Meeting', 'id': meetings_agenda.id, 'slug': u'foo-bar-meeting',
{'text': 'Foo bar Meeting', 'id': u'foo-bar-meeting', 'slug': 'foo-bar-meeting',
'kind': 'meetings',
'api': {'meetings_url': 'http://testserver/api/agenda/%s/meetings/' % meetings_agenda.slug,
'desks_url': 'http://testserver/api/agenda/%s/desks/' % meetings_agenda.slug,
},
},
{'text': 'Foo bar2', 'id': agenda2.id, 'slug': u'foo-bar2', 'kind': 'events',
{'text': 'Foo bar2', 'id': u'foo-bar2', 'kind': 'events', 'slug': 'foo-bar2',
'api': {'datetimes_url': 'http://testserver/api/agenda/%s/datetimes/' % agenda2.slug}}
]}
@ -682,7 +682,7 @@ def test_agenda_detail_api(app, some_data):
agenda = Agenda.objects.get(slug='foo-bar')
resp = app.get('/api/agenda/%s/' % agenda.slug)
data = resp.json['data']
assert data['id'] == 1
assert data['id'] == 'foo-bar'
assert data['slug'] == 'foo-bar'
assert data['text'] == 'Foo bar'
assert data['kind'] == 'events'