Пример #1
0
 def setUpTestData(cls):
     super().setUpTestData()
     print('creating test models')
     create_test_models(days=7)
     cls.test_get = True
     cls.required_permission = ''
     cls.url = 'cash_desk_balance'
     cls.kwargs = {}
     cls.referer = '/'
     cls.get_template = 'cash_desk/cashclose_detail.html'
Пример #2
0
 def setUpTestData(cls):
     super().setUpTestData()
     print('creating test models')
     create_test_models(days=2)
     cls.test_get = True
     cls.required_permission = 'cash_desk.add_cashclose'
     cls.url = 'cashclose_document'
     cls.kwargs = {'cashclose_code': CashClose.objects.first().code}
     cls.referer = '/'
     cls.get_template = 'cash_desk/cashclose_document.html'
Пример #3
0
def test_database_setup():  # pragma: no cover
    # Test if the database is populated
    User = get_user_model()
    try:
        import pdb
        pdb.set_trace()
        User.objects.get(username='******')

    # Create models if this is a new db
    except User.DoesNotExist:
        print('New database')
        model_creation.create_default_models()
        model_creation.create_test_models(days=30)
Пример #4
0
 def setUpTestData(cls):
     super().setUpTestData()
     cls.model_attrs = [
         '__str__',
         'code',
         'created',
         'employee',
         'notes',
         'updated',
         'balance',
         'breakdown_by_department',
         'breakdown_by_concept_type',
         'breakdowns',
         'concepts',
     ]
     model_creation.create_test_models(days=3)
     cls.model_object = apps.get_model('cash_desk.CashClose').objects.first()
Пример #5
0
 def test_create_test_models(self):
     self.assertIsNone(model_creation.create_test_models(days=2))
Пример #6
0
        # issue is really that Django is missing to avoid masking other
        # exceptions on Python 2.
        try:
            import django
        except ImportError:
            raise ImportError(
                "Couldn't import Django. Are you sure it's installed and "
                "available on your PYTHONPATH environment variable? Did you "
                "forget to activate a virtual environment?")
        raise

    # Make migrations
    execute_from_command_line(['manage.py', 'makemigrations'])

    # Migrate
    execute_from_command_line(['manage.py', 'migrate'])

    # Collect static files
    execute_from_command_line(['manage.py', 'collectstatic', '--noinput'])

    # Create default models
    from clickgestion.core.model_creation import create_default_models, create_test_models
    print('Creating default models')
    create_default_models()
    print('Creating test models')
    create_test_models()
    #from django.conf import settings
    #if settings.DEBUG:
    #print('Creating test models')
    #create_test_models()
Пример #7
0
 def setUpTestData(cls):
     super().setUpTestData()
     print('creating test models')
     create_test_models(days=7)