Project

General

Profile

« Previous | Next » 

Revision e01c978b

Added by Frédéric Péters over 5 years ago

general: update for compatibility with django 2.2 (#41626)

View differences:

tests/test_api.py
4 4
from uuid import uuid4
5 5

  
6 6

  
7
from django.core.urlresolvers import reverse
7
from django.urls import reverse
8 8
from django.utils.http import urlencode
9 9
from django.contrib.auth import get_user_model
10 10
from django.utils.text import slugify
......
50 50

  
51 51

  
52 52
def test_get_newsletters(app, categories, announces, user):
53
    resp = app.get(reverse('newsletters'), status=403)
53
    resp = app.get(reverse('newsletters'), status=(401, 403))
54 54
    app.authorization = ('Basic', ('john.doe', 'password'))
55 55
    resp = app.get(reverse('newsletters'))
56 56
    data = resp.json
......
65 65

  
66 66

  
67 67
def test_get_subscriptions(app, categories, announces, user):
68
    resp = app.get(reverse('subscriptions'), status=403)
68
    resp = app.get(reverse('subscriptions'), status=(401, 403))
69 69
    uuid = str(uuid4())
70
    resp = app.get(reverse('subscriptions'), params={'uuid': uuid}, status=403)
70
    resp = app.get(reverse('subscriptions'), params={'uuid': uuid}, status=(401, 403))
71 71
    app.authorization = ('Basic', ('john.doe', 'password'))
72 72

  
73 73
    for identifier, name in channel_choices:
......
105 105
def test_delete_subscriptions(app, categories, announces, user):
106 106
    params = urlencode({'uuid': str(uuid4())})
107 107
    subscriptions_url = reverse('subscriptions') + '?' + params
108
    resp = app.delete(subscriptions_url, status=403)
108
    resp = app.delete(subscriptions_url, status=(401, 403))
109 109
    app.authorization = ('Basic', ('john.doe', 'password'))
110 110
    resp = app.delete(subscriptions_url)
111 111
    if resp.json['data']:
......
119 119
    url = '/api/subscribe/?uuid=%s&email=john@example.net' % uuid
120 120

  
121 121
    # anonymous
122
    resp = app.post_json(url, params=payload, status=403)
122
    resp = app.post_json(url, params=payload, status=(401, 403))
123 123
    assert resp.json['detail'] == 'Authentication credentials were not provided.'
124 124

  
125 125
    # authenticated

Also available in: Unified diff