-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.py
28 lines (21 loc) · 844 Bytes
/
tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import pytest
from django.urls import reverse
from django.contrib.auth.models import User
@pytest.mark.skip("not working")
@pytest.mark.django_db
def test_headless_allauth_login(client):
username = 'testuser'
password = 'testpassword123'
email = '[email protected]'
User.objects.create_user(username=username, password=password, email=email)
login_url = reverse('headless:browser:account:login')
login_data = {
'username': username,
'password': password,
}
response = client.post(login_url, login_data, content_type='application/json')
assert response.status_code == 200, response.content
response_data = response.json()
assert response_data['meta']['is_authenticated']
assert response_data['data']['user']['email'] == email
assert '_auth_user_id' in client.session