Exemplo n.º 1
0
    def test_is_enabled_in_LoginCode_model(self):
        user = get_user_model().objects.create()
        login_code = LoginCode.objects.create(user=user)

        self.assertTrue(hasattr(login_code, 'deleted'))
        self.assertFalse(login_code.deleted)

        login_code.delete()

        self.assertTrue(login_code.deleted)
        self.assertFalse(LoginCode.objects.all())
Exemplo n.º 2
0
 def setUp(self):
     self.c = Client()
     self.user = get_user_model().objects.create(username='******')
Exemplo n.º 3
0
 def setUp(self):
     self.user = get_user_model().objects.create(username='******')
     self.inactive_user = get_user_model().objects.create(
         username='******', is_active=False)
Exemplo n.º 4
0
 def setUp(self):
     self.c = Client()
     self.user = get_user_model().objects.create(username='******')
Exemplo n.º 5
0
 def setUp(self):
     self.user = get_user_model().objects.create(username='******')
     self.inactive_user = get_user_model().objects.create(username='******', is_active=False)
Exemplo n.º 6
0
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models

# Get the right user model
# Using `tests.CustomUser` fails when using django 1.4 where custom user is not supported
# Travis built that fails
# https://travis-ci.org/relekang/django-nopassword/builds/20701865
# Blog post about this issue
# http://kevindias.com/writing/django-custom-user-models-south-and-reusable-apps/
from django_nopassword.utils import get_user_model

User = get_user_model()

user_orm_label = u'%s.%s' % (User._meta.app_label, User._meta.object_name)
user_model_label = u'%s.%s' % (User._meta.app_label, User._meta.module_name)


class Migration(SchemaMigration):

    def forwards(self, orm):
        # Adding model 'LoginCode'
        db.create_table(u'django_nopassword_logincode', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('user', self.gf('django.db.models.fields.related.ForeignKey')(related_name='login_codes', to=orm[user_orm_label])),
            ('code', self.gf('django.db.models.fields.CharField')(max_length=20)),
            ('timestamp', self.gf('django.db.models.fields.DateTimeField')()),
            ('next', self.gf('django.db.models.fields.TextField')(blank=True)),
        ))