Commit 718d9f6c authored by Florent Chehab's avatar Florent Chehab
Browse files

bug corrected in user creation

parent 047ae66b
Pipeline #21972 passed with stages
in 3 minutes and 7 seconds
...@@ -29,3 +29,8 @@ To populate universities, also run in `./manage.py shell`: ...@@ -29,3 +29,8 @@ To populate universities, also run in `./manage.py shell`:
``` ```
Follow this tutorial : https://devcenter.heroku.com/articles/heroku-postgresql#local-setup Follow this tutorial : https://devcenter.heroku.com/articles/heroku-postgresql#local-setup
in postgre
ALTER USER username CREATEDB;
GREATE DATABASE florent;
GRANT ALL on DATABASE florent to florent;
...@@ -97,20 +97,20 @@ DATABASES = { ...@@ -97,20 +97,20 @@ DATABASES = {
AUTH_PASSWORD_VALIDATORS = [ AUTH_PASSWORD_VALIDATORS = [
{ {
'NAME': 'django.contrib.auth.password_validation.\ 'NAME': 'django.contrib.auth.password_validation.'
UserAttributeSimilarityValidator', 'UserAttributeSimilarityValidator',
}, },
{ {
'NAME': 'django.contrib.auth.password_validation.\ 'NAME': 'django.contrib.auth.password_validation.'
MinimumLengthValidator', 'MinimumLengthValidator',
}, },
{ {
'NAME': 'django.contrib.auth.password_validation.\ 'NAME': 'django.contrib.auth.password_validation.'
CommonPasswordValidator', 'CommonPasswordValidator',
}, },
{ {
'NAME': 'django.contrib.auth.password_validation.\ 'NAME': 'django.contrib.auth.password_validation.'
NumericPasswordValidator', 'NumericPasswordValidator',
}, },
] ]
...@@ -136,6 +136,7 @@ except KeyError: ...@@ -136,6 +136,7 @@ except KeyError:
dev_env = False dev_env = False
if dev_env: if dev_env:
print("You are running in development mode")
DEBUG = True DEBUG = True
ALLOWED_HOSTS = [] ALLOWED_HOSTS = []
SECRET_KEY = '0a1kbtt%as4624u*9+r+c%j1tlq&dc08==c3w604(4igc+t6tw' SECRET_KEY = '0a1kbtt%as4624u*9+r+c%j1tlq&dc08==c3w604(4igc+t6tw'
......
from django.test import TestCase
from django.contrib.auth.models import User
from django.test.client import Client
class SuperUserTest(TestCase):
def setUp(self):
password = 'root'
self.my_admin = User.objects.create_superuser(
'myuser', 'myemail@test.com', password)
self.c = Client()
self.c.login(username=self.my_admin.username, password=password)
def test_created(self):
"""
Simple test to check if we can create a superuser. We had issues in the past.
"""
self.assertTrue(self.my_admin.is_superuser)
# Generated by Django 2.0.3 on 2018-04-23 09:44 # Generated by Django 2.0.3 on 2018-04-23 15:30
import django.core.validators import django.core.validators
from django.db import migrations, models from django.db import migrations, models
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment