def test_create_superuser(db, client): credentials = {'email': '*****@*****.**', 'password': '******'} # Test admin creation assert User.objects.all().count() == 0 create_superuser(credentials) assert User.objects.all().count() == 1 admin = User.objects.all().first() assert admin.is_superuser # Test duplicating create_superuser(credentials) assert User.objects.all().count() == 1 # Test logging in response = client.post('/account/login/', {'username': credentials['email'], 'password': credentials['password']}, follow=True) assert response.context['request'].user == admin
def test_create_superuser(db, client): credentials = {'email': '*****@*****.**', 'password': '******'} # Test admin creation assert User.objects.all().count() == 0 create_superuser(credentials) assert User.objects.all().count() == 1 admin = User.objects.all().first() assert admin.is_superuser # Test duplicating create_superuser(credentials) assert User.objects.all().count() == 1 # Test logging in response = client.post('/account/login/', {'username': credentials['email'], 'password': credentials['password']}, follow=True) assert response.context['request'].user == admin
def test_create_superuser(db, client, media_root): credentials = {"email": "*****@*****.**", "password": "******"} # Test admin creation assert User.objects.all().count() == 0 create_superuser(credentials) assert User.objects.all().count() == 1 admin = User.objects.all().first() assert admin.is_superuser assert admin.avatar # Test duplicating create_superuser(credentials) assert User.objects.all().count() == 1 # Test logging in response = client.post( reverse("account:login"), {"username": credentials["email"], "password": credentials["password"]}, follow=True, ) assert response.context["request"].user == admin
def test_create_superuser(db, client, media_root): credentials = {"email": "*****@*****.**", "password": "******"} # Test admin creation assert User.objects.all().count() == 0 create_superuser(credentials) assert User.objects.all().count() == 1 admin = User.objects.all().first() assert admin.is_superuser assert admin.avatar # Test duplicating create_superuser(credentials) assert User.objects.all().count() == 1 # Test logging in response = client.post( reverse("account:login"), {"username": credentials["email"], "password": credentials["password"]}, follow=True, ) assert response.context["request"].user == admin