Removed an unused and unnecessary API endpoint, now that gather.town has gotten OpenID Connect authentication working.
- Legacy-Id: 18190
This commit is contained in:
parent
1239e91b72
commit
d8b11c4293
|
@ -277,24 +277,6 @@ class CustomApiTests(TestCase):
|
|||
self.assertEqual(data['user']['email'], secretariat.user.email)
|
||||
|
||||
|
||||
def test_api_v2_person_access_meetecho(self):
|
||||
url = urlreverse('ietf.api.views.person_access_meetecho')
|
||||
person = PersonFactory()
|
||||
apikey = PersonalApiKey.objects.create(endpoint=url, person=person)
|
||||
|
||||
# error cases
|
||||
r = self.client.get(url, {'apikey': apikey.hash()})
|
||||
self.assertContains(r, "Too long since last regular login", status_code=400)
|
||||
person.user.last_login = timezone.now()
|
||||
person.user.save()
|
||||
|
||||
# working case
|
||||
r = self.client.get(url, {'apikey': apikey.hash()})
|
||||
self.assertEqual(r.status_code, 200)
|
||||
data = r.json()
|
||||
self.assertEqual(data['name'], person.plain_name())
|
||||
self.assertEqual(data['email'], person.email().address)
|
||||
|
||||
def test_api_new_meeting_registration(self):
|
||||
meeting = MeetingFactory(type_id='ietf')
|
||||
reg = {
|
||||
|
|
|
@ -34,8 +34,6 @@ urlpatterns = [
|
|||
url(r'^notify/meeting/registration/?', api_views.api_new_meeting_registration),
|
||||
# OpenID authentication provider
|
||||
url(r'^openid/', include('oidc_provider.urls', namespace='oidc_provider')),
|
||||
# For meetecho access
|
||||
url(r'^person/access/meetecho', api_views.person_access_meetecho),
|
||||
# Draft submission API
|
||||
url(r'^submit/?$', submit_views.api_submit),
|
||||
]
|
||||
|
|
|
@ -102,19 +102,26 @@ class ApiV2PersonExportView(DetailView, JsonExportMixin):
|
|||
|
||||
return self.json_view(request, filter=querydict.dict(), expand=expand)
|
||||
|
||||
@require_api_key
|
||||
@csrf_exempt
|
||||
def person_access_meetecho(request):
|
||||
person = get_object_or_404(Person, user=request.user)
|
||||
|
||||
return HttpResponse(json.dumps({
|
||||
'name' : person.plain_name(),
|
||||
'email': person.email().address,
|
||||
'roles': {
|
||||
'chair': list(person.role_set.filter(name='chair', group__state__in=['active', 'bof', 'proposed']).values_list('group__acronym', flat=True)),
|
||||
'secr': list(person.role_set.filter(name='secr', group__state__in=['active', 'bof', 'proposed']).values_list('group__acronym', flat=True)),
|
||||
}
|
||||
}), content_type='application/json')
|
||||
# @require_api_key
|
||||
# @csrf_exempt
|
||||
# def person_access_token(request):
|
||||
# person = get_object_or_404(Person, user=request.user)
|
||||
#
|
||||
# if request.method == 'POST':
|
||||
# client_id = request.POST.get('client_id', None)
|
||||
# client_secret = request.POST.get('client_secret', None)
|
||||
# client = get_object_or_404(ClientRecord, client_id=client_id, client_secret=client_secret)
|
||||
#
|
||||
# return HttpResponse(json.dumps({
|
||||
# 'name' : person.plain_name(),
|
||||
# 'email': person.email().address,
|
||||
# 'roles': {
|
||||
# 'chair': list(person.role_set.filter(name='chair', group__state__in=['active', 'bof', 'proposed']).values_list('group__acronym', flat=True)),
|
||||
# 'secr': list(person.role_set.filter(name='secr', group__state__in=['active', 'bof', 'proposed']).values_list('group__acronym', flat=True)),
|
||||
# }
|
||||
# }), content_type='application/json')
|
||||
# else:
|
||||
# return HttpResponse(status=405)
|
||||
|
||||
@require_api_key
|
||||
@role_required('Robot')
|
||||
|
|
|
@ -530,8 +530,9 @@ class IetfAuthTests(TestCase):
|
|||
self.assertTrue(user.check_password('password'))
|
||||
|
||||
def test_apikey_management(self):
|
||||
person = PersonFactory()
|
||||
|
||||
# Create a person with a role that will give at least one valid apikey
|
||||
person = RoleFactory(name_id='secr', group__acronym='secretariat').person
|
||||
|
||||
url = urlreverse('ietf.ietfauth.views.apikey_index')
|
||||
|
||||
# Check that the url is protected, then log in
|
||||
|
@ -632,7 +633,7 @@ class IetfAuthTests(TestCase):
|
|||
from ietf.ietfauth.management.commands.send_apikey_usage_emails import Command
|
||||
from ietf.utils.mail import outbox, empty_outbox
|
||||
|
||||
person = PersonFactory()
|
||||
person = RoleFactory(name_id='secr', group__acronym='secretariat').person
|
||||
|
||||
url = urlreverse('ietf.ietfauth.views.apikey_create')
|
||||
# Check that the url is protected, then log in
|
||||
|
|
|
@ -340,7 +340,6 @@ PERSON_API_KEY_VALUES = [
|
|||
("/api/iesg/position", "/api/iesg/position", "Area Director"),
|
||||
("/api/v2/person/person", "/api/v2/person/person", "Secretariat"),
|
||||
("/api/meeting/session/video/url", "/api/meeting/session/video/url", "Recording Manager"),
|
||||
("/api/person/access/meetecho", "/api/person/access/meetecho", None),
|
||||
("/api/notify/meeting/registration", "/api/notify/meeting/registration", "Robot"),
|
||||
]
|
||||
PERSON_API_KEY_ENDPOINTS = [ (v, n) for (v, n, r) in PERSON_API_KEY_VALUES ]
|
||||
|
|
Loading…
Reference in a new issue