Add test migration in folder
This commit is contained in:
1 parent
99534e4eb9
commit
f0021dc139
11 files changed
+45
-2
No files matched your search
Whitespace-only changes.
Whitespace-only changes.
@@ -0,0 +1,3 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
@@ -0,0 +1,5 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class TestApp3Config(AppConfig):
|
||||
name = 'test_app3'
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
# Generated by Django 2.1.4 on 2019-01-04 20:55
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='C',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('not_null_field', models.IntegerField()),
|
||||
],
|
||||
),
|
||||
]
|
||||
Whitespace-only changes.
@@ -0,0 +1,4 @@
|
||||
from django.db import models
|
||||
|
||||
class C(models.Model):
|
||||
not_null_field = models.IntegerField(null=False)
|
||||
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
@@ -0,0 +1,3 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
||||
@@ -11,10 +11,12 @@ https://docs.djangoproject.com/en/1.11/ref/settings/
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
sys.path.insert(0, os.path.join(BASE_DIR, 'apps'))
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
|
||||
@@ -38,7 +40,8 @@ INSTALLED_APPS = [
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'test_app1',
|
||||
'test_app2'
|
||||
'test_app2',
|
||||
'apps.test_app3',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
|
||||
@@ -80,12 +80,13 @@ class TestLinterFunctions(unittest.TestCase):
|
||||
def test_gather_all_migrations(self):
|
||||
linter = MigrationLinter(fixtures.CORRECT_PROJECT)
|
||||
migrations = linter._gather_all_migrations()
|
||||
self.assertEqual(len(migrations), 3)
|
||||
self.assertEqual(len(migrations), 4)
|
||||
self.assertEqual(
|
||||
sorted(migrations),
|
||||
sorted([
|
||||
("test_app1", "0001_initial"),
|
||||
("test_app1", "0002_a_new_null_field"),
|
||||
("test_app2", "0001_foo"),
|
||||
("test_app3", "0001_initial"),
|
||||
])
|
||||
)
|
||||
Reference in new issue
Block a user