mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-25 18:44:23 +00:00
Another date field update
This commit is contained in:
parent
367fddbdab
commit
2b999d87ba
@ -18,7 +18,7 @@ class Command(BaseCommand):
|
|||||||
call_command('migrate')
|
call_command('migrate')
|
||||||
u = User(username='root', last_name="", first_name="Bibou",
|
u = User(username='root', last_name="", first_name="Bibou",
|
||||||
email="ae.info@utbm.fr",
|
email="ae.info@utbm.fr",
|
||||||
date_of_birth="1942-06-12T00:00:00+01:00",
|
date_of_birth="1942-06-12",
|
||||||
is_superuser=True, is_staff=True)
|
is_superuser=True, is_staff=True)
|
||||||
u.set_password("plop")
|
u.set_password("plop")
|
||||||
u.save()
|
u.save()
|
||||||
@ -28,13 +28,13 @@ class Command(BaseCommand):
|
|||||||
print("Dev mode, adding some test data")
|
print("Dev mode, adding some test data")
|
||||||
s = User(username='skia', last_name="Kia", first_name="S'",
|
s = User(username='skia', last_name="Kia", first_name="S'",
|
||||||
email="skia@git.an",
|
email="skia@git.an",
|
||||||
date_of_birth="1942-06-12T00:00:00+01:00",
|
date_of_birth="1942-06-12",
|
||||||
is_superuser=True, is_staff=True)
|
is_superuser=True, is_staff=True)
|
||||||
s.set_password("plop")
|
s.set_password("plop")
|
||||||
s.save()
|
s.save()
|
||||||
u = User(username='guy', last_name="Carlier", first_name="Guy",
|
u = User(username='guy', last_name="Carlier", first_name="Guy",
|
||||||
email="guy@git.an",
|
email="guy@git.an",
|
||||||
date_of_birth="1942-06-12T00:00:00+01:00",
|
date_of_birth="1942-06-12",
|
||||||
is_superuser=False, is_staff=False)
|
is_superuser=False, is_staff=False)
|
||||||
u.set_password("plop")
|
u.set_password("plop")
|
||||||
u.save()
|
u.save()
|
||||||
|
19
core/migrations/0005_auto_20160128_0842.py
Normal file
19
core/migrations/0005_auto_20160128_0842.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('core', '0004_auto_20160128_0835'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='user',
|
||||||
|
name='date_joined',
|
||||||
|
field=models.DateField(auto_now_add=True, verbose_name='date joined'),
|
||||||
|
),
|
||||||
|
]
|
@ -60,7 +60,7 @@ class User(AbstractBaseUser, PermissionsMixin):
|
|||||||
'Unselect this instead of deleting accounts.'
|
'Unselect this instead of deleting accounts.'
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
date_joined = models.DateTimeField(_('date joined'), auto_now_add=True)
|
date_joined = models.DateField(_('date joined'), auto_now_add=True)
|
||||||
owner_group = models.ForeignKey(Group, related_name="owned_user",
|
owner_group = models.ForeignKey(Group, related_name="owned_user",
|
||||||
default=settings.AE_GROUPS['root']['id'])
|
default=settings.AE_GROUPS['root']['id'])
|
||||||
edit_group = models.ManyToManyField(Group, related_name="editable_user", blank=True)
|
edit_group = models.ManyToManyField(Group, related_name="editable_user", blank=True)
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
from django.test import SimpleTestCase, Client, TestCase
|
from django.test import Client, TestCase
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.contrib.auth.models import Group
|
from django.contrib.auth.models import Group
|
||||||
|
from django.core.management import call_command
|
||||||
|
|
||||||
from core.models import User, Group
|
from core.models import User, Group
|
||||||
#from core.views.forms import RegisteringForm, LoginForm
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
to run these tests :
|
to run these tests :
|
||||||
@ -16,8 +16,8 @@ class UserRegistrationTest(TestCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
try:
|
try:
|
||||||
Group.objects.create(name="root")
|
Group.objects.create(name="root")
|
||||||
except:
|
except Exception as e:
|
||||||
pass
|
print(e)
|
||||||
|
|
||||||
def test_register_user_form_ok(self):
|
def test_register_user_form_ok(self):
|
||||||
"""
|
"""
|
||||||
@ -169,21 +169,22 @@ class PageHandlingTest(TestCase):
|
|||||||
Group.objects.create(name="root")
|
Group.objects.create(name="root")
|
||||||
u = User(username='root', last_name="", first_name="Bibou",
|
u = User(username='root', last_name="", first_name="Bibou",
|
||||||
email="ae.info@utbm.fr",
|
email="ae.info@utbm.fr",
|
||||||
date_of_birth="1942-06-12T00:00:00+01:00",
|
date_of_birth="1942-06-12",
|
||||||
is_superuser=True, is_staff=True)
|
is_superuser=True, is_staff=True)
|
||||||
u.set_password("plop")
|
u.set_password("plop")
|
||||||
u.save()
|
u.save()
|
||||||
self.client.login(username='root', password='plop')
|
self.client.login(username='root', password='plop')
|
||||||
except:
|
except Exception as e:
|
||||||
pass
|
print(e)
|
||||||
|
|
||||||
def test_create_page_ok(self):
|
def test_create_page_ok(self):
|
||||||
"""
|
"""
|
||||||
Should create a page correctly
|
Should create a page correctly
|
||||||
"""
|
"""
|
||||||
self.client.post(reverse('core:page_prop', kwargs={'page_name': 'guy'}), {'parent': '',
|
self.client.post(reverse('core:page_prop', kwargs={'page_name': 'guy'}), {
|
||||||
|
'parent': '',
|
||||||
'name': 'guy',
|
'name': 'guy',
|
||||||
'owner_group': '1',
|
'owner_group': 1,
|
||||||
})
|
})
|
||||||
response = self.client.get(reverse('core:page', kwargs={'page_name': 'guy'}))
|
response = self.client.get(reverse('core:page', kwargs={'page_name': 'guy'}))
|
||||||
self.assertTrue(response.status_code == 200)
|
self.assertTrue(response.status_code == 200)
|
||||||
@ -193,11 +194,13 @@ class PageHandlingTest(TestCase):
|
|||||||
"""
|
"""
|
||||||
Should create a page correctly
|
Should create a page correctly
|
||||||
"""
|
"""
|
||||||
self.client.post(reverse('core:page_prop', kwargs={'page_name': 'guy'}), {'parent': '',
|
self.client.post(reverse('core:page_prop', kwargs={'page_name': 'guy'}), {
|
||||||
|
'parent': '',
|
||||||
'name': 'guy',
|
'name': 'guy',
|
||||||
'owner_group': '1',
|
'owner_group': '1',
|
||||||
})
|
})
|
||||||
response = self.client.post(reverse('core:page_prop', kwargs={'page_name': 'guy/bibou'}), {'parent': '1',
|
response = self.client.post(reverse('core:page_prop', kwargs={'page_name': 'guy/bibou'}), {
|
||||||
|
'parent': '1',
|
||||||
'name': 'bibou',
|
'name': 'bibou',
|
||||||
'owner_group': '1',
|
'owner_group': '1',
|
||||||
})
|
})
|
||||||
@ -209,12 +212,14 @@ class PageHandlingTest(TestCase):
|
|||||||
"""
|
"""
|
||||||
Should display a page correctly
|
Should display a page correctly
|
||||||
"""
|
"""
|
||||||
self.client.post(reverse('core:page_prop', kwargs={'page_name': 'guy'}), {'parent': '',
|
self.client.post(reverse('core:page_prop', kwargs={'page_name': 'guy'}), {
|
||||||
|
'parent': '',
|
||||||
'name': 'guy',
|
'name': 'guy',
|
||||||
'title': 'Guy',
|
'title': 'Guy',
|
||||||
'Content': 'Guyéuyuyé',
|
'Content': 'Guyéuyuyé',
|
||||||
})
|
})
|
||||||
self.client.post(reverse('core:page_prop', kwargs={'page_name': 'guy/bibou'}), {'parent': '1',
|
self.client.post(reverse('core:page_prop', kwargs={'page_name': 'guy/bibou'}), {
|
||||||
|
'parent': '1',
|
||||||
'name': 'bibou',
|
'name': 'bibou',
|
||||||
'title': 'Bibou',
|
'title': 'Bibou',
|
||||||
'Content':
|
'Content':
|
||||||
@ -237,12 +242,12 @@ class PageHandlingTest(TestCase):
|
|||||||
"""
|
"""
|
||||||
Should format the markdown and escape html correctly
|
Should format the markdown and escape html correctly
|
||||||
"""
|
"""
|
||||||
self.client.post(reverse('core:page_prop', kwargs={'page_name': 'guy'}), {'parent': '',
|
self.client.post(reverse('core:page_prop', kwargs={'page_name': 'guy'}), {
|
||||||
|
'parent': '',
|
||||||
'name': 'guy',
|
'name': 'guy',
|
||||||
'owner_group': '1',
|
'owner_group': '1',
|
||||||
})
|
})
|
||||||
r = self.client.post(reverse('core:page_edit', kwargs={'page_name': 'guy'}),
|
r = self.client.post(reverse('core:page_edit', kwargs={'page_name': 'guy'}), {
|
||||||
{
|
|
||||||
'title': 'Bibou',
|
'title': 'Bibou',
|
||||||
'content':
|
'content':
|
||||||
'''Guy *bibou*
|
'''Guy *bibou*
|
||||||
|
Loading…
Reference in New Issue
Block a user