mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-21 21:53:30 +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')
|
||||
u = User(username='root', last_name="", first_name="Bibou",
|
||||
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)
|
||||
u.set_password("plop")
|
||||
u.save()
|
||||
@ -28,13 +28,13 @@ class Command(BaseCommand):
|
||||
print("Dev mode, adding some test data")
|
||||
s = User(username='skia', last_name="Kia", first_name="S'",
|
||||
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)
|
||||
s.set_password("plop")
|
||||
s.save()
|
||||
u = User(username='guy', last_name="Carlier", first_name="Guy",
|
||||
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)
|
||||
u.set_password("plop")
|
||||
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.'
|
||||
),
|
||||
)
|
||||
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",
|
||||
default=settings.AE_GROUPS['root']['id'])
|
||||
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.contrib.auth.models import Group
|
||||
from django.core.management import call_command
|
||||
|
||||
from core.models import User, Group
|
||||
#from core.views.forms import RegisteringForm, LoginForm
|
||||
|
||||
"""
|
||||
to run these tests :
|
||||
@ -16,8 +16,8 @@ class UserRegistrationTest(TestCase):
|
||||
def setUp(self):
|
||||
try:
|
||||
Group.objects.create(name="root")
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
def test_register_user_form_ok(self):
|
||||
"""
|
||||
@ -169,22 +169,23 @@ class PageHandlingTest(TestCase):
|
||||
Group.objects.create(name="root")
|
||||
u = User(username='root', last_name="", first_name="Bibou",
|
||||
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)
|
||||
u.set_password("plop")
|
||||
u.save()
|
||||
self.client.login(username='root', password='plop')
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
def test_create_page_ok(self):
|
||||
"""
|
||||
Should create a page correctly
|
||||
"""
|
||||
self.client.post(reverse('core:page_prop', kwargs={'page_name': 'guy'}), {'parent': '',
|
||||
'name': 'guy',
|
||||
'owner_group': '1',
|
||||
})
|
||||
self.client.post(reverse('core:page_prop', kwargs={'page_name': 'guy'}), {
|
||||
'parent': '',
|
||||
'name': 'guy',
|
||||
'owner_group': 1,
|
||||
})
|
||||
response = self.client.get(reverse('core:page', kwargs={'page_name': 'guy'}))
|
||||
self.assertTrue(response.status_code == 200)
|
||||
self.assertTrue("<strong>guy</strong>" in str(response.content))
|
||||
@ -193,14 +194,16 @@ class PageHandlingTest(TestCase):
|
||||
"""
|
||||
Should create a page correctly
|
||||
"""
|
||||
self.client.post(reverse('core:page_prop', kwargs={'page_name': 'guy'}), {'parent': '',
|
||||
'name': 'guy',
|
||||
'owner_group': '1',
|
||||
})
|
||||
response = self.client.post(reverse('core:page_prop', kwargs={'page_name': 'guy/bibou'}), {'parent': '1',
|
||||
'name': 'bibou',
|
||||
'owner_group': '1',
|
||||
})
|
||||
self.client.post(reverse('core:page_prop', kwargs={'page_name': 'guy'}), {
|
||||
'parent': '',
|
||||
'name': 'guy',
|
||||
'owner_group': '1',
|
||||
})
|
||||
response = self.client.post(reverse('core:page_prop', kwargs={'page_name': 'guy/bibou'}), {
|
||||
'parent': '1',
|
||||
'name': 'bibou',
|
||||
'owner_group': '1',
|
||||
})
|
||||
response = self.client.get(reverse('core:page', kwargs={'page_name': 'guy/bibou'}))
|
||||
self.assertTrue(response.status_code == 200)
|
||||
self.assertTrue("<strong>guy/bibou</strong>" in str(response.content))
|
||||
@ -209,17 +212,19 @@ class PageHandlingTest(TestCase):
|
||||
"""
|
||||
Should display a page correctly
|
||||
"""
|
||||
self.client.post(reverse('core:page_prop', kwargs={'page_name': 'guy'}), {'parent': '',
|
||||
'name': 'guy',
|
||||
'title': 'Guy',
|
||||
'Content': 'Guyéuyuyé',
|
||||
})
|
||||
self.client.post(reverse('core:page_prop', kwargs={'page_name': 'guy/bibou'}), {'parent': '1',
|
||||
'name': 'bibou',
|
||||
'title': 'Bibou',
|
||||
'Content':
|
||||
'Bibibibiblblblblblbouuuuuuuuu',
|
||||
})
|
||||
self.client.post(reverse('core:page_prop', kwargs={'page_name': 'guy'}), {
|
||||
'parent': '',
|
||||
'name': 'guy',
|
||||
'title': 'Guy',
|
||||
'Content': 'Guyéuyuyé',
|
||||
})
|
||||
self.client.post(reverse('core:page_prop', kwargs={'page_name': 'guy/bibou'}), {
|
||||
'parent': '1',
|
||||
'name': 'bibou',
|
||||
'title': 'Bibou',
|
||||
'Content':
|
||||
'Bibibibiblblblblblbouuuuuuuuu',
|
||||
})
|
||||
response = self.client.get(reverse('core:page', kwargs={'page_name': 'guy/bibou'}))
|
||||
self.assertTrue(response.status_code == 200)
|
||||
#self.assertTrue('PAGE_FOUND : Bibou' in str(response.content))
|
||||
@ -237,12 +242,12 @@ class PageHandlingTest(TestCase):
|
||||
"""
|
||||
Should format the markdown and escape html correctly
|
||||
"""
|
||||
self.client.post(reverse('core:page_prop', kwargs={'page_name': 'guy'}), {'parent': '',
|
||||
'name': 'guy',
|
||||
'owner_group': '1',
|
||||
})
|
||||
r = self.client.post(reverse('core:page_edit', kwargs={'page_name': 'guy'}),
|
||||
{
|
||||
self.client.post(reverse('core:page_prop', kwargs={'page_name': 'guy'}), {
|
||||
'parent': '',
|
||||
'name': 'guy',
|
||||
'owner_group': '1',
|
||||
})
|
||||
r = self.client.post(reverse('core:page_edit', kwargs={'page_name': 'guy'}), {
|
||||
'title': 'Bibou',
|
||||
'content':
|
||||
'''Guy *bibou*
|
||||
|
Loading…
Reference in New Issue
Block a user