From 691b1b82cba7c225c06903f8da36d3d41d0849bb Mon Sep 17 00:00:00 2001 From: David Wobrock Date: Fri, 7 Feb 2020 22:31:13 +0100 Subject: [PATCH] Add app_data_migration used for tests --- .../app_data_migrations/__init__.py | 0 .../test_project/app_data_migrations/admin.py | 3 ++ .../test_project/app_data_migrations/apps.py | 5 ++++ .../migrations/0001_initial.py | 28 +++++++++++++++++++ .../migrations/0002_missing_reverse.py | 18 ++++++++++++ .../migrations/0003_incorrect_arguments.py | 22 +++++++++++++++ .../migrations/__init__.py | 0 .../app_data_migrations/models.py | 5 ++++ .../test_project/app_data_migrations/tests.py | 3 ++ .../test_project/app_data_migrations/views.py | 3 ++ 10 files changed, 87 insertions(+) create mode 100644 tests/test_project/app_data_migrations/__init__.py create mode 100644 tests/test_project/app_data_migrations/admin.py create mode 100644 tests/test_project/app_data_migrations/apps.py create mode 100644 tests/test_project/app_data_migrations/migrations/0001_initial.py create mode 100644 tests/test_project/app_data_migrations/migrations/0002_missing_reverse.py create mode 100644 tests/test_project/app_data_migrations/migrations/0003_incorrect_arguments.py create mode 100644 tests/test_project/app_data_migrations/migrations/__init__.py create mode 100644 tests/test_project/app_data_migrations/models.py create mode 100644 tests/test_project/app_data_migrations/tests.py create mode 100644 tests/test_project/app_data_migrations/views.py diff --git a/tests/test_project/app_data_migrations/__init__.py b/tests/test_project/app_data_migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_project/app_data_migrations/admin.py b/tests/test_project/app_data_migrations/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/tests/test_project/app_data_migrations/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/tests/test_project/app_data_migrations/apps.py b/tests/test_project/app_data_migrations/apps.py new file mode 100644 index 0000000..9f9d755 --- /dev/null +++ b/tests/test_project/app_data_migrations/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class AppDataMigrationsConfig(AppConfig): + name = "tests.test_project.app_data_migrations" diff --git a/tests/test_project/app_data_migrations/migrations/0001_initial.py b/tests/test_project/app_data_migrations/migrations/0001_initial.py new file mode 100644 index 0000000..389b564 --- /dev/null +++ b/tests/test_project/app_data_migrations/migrations/0001_initial.py @@ -0,0 +1,28 @@ +# Generated by Django 2.2 on 2020-01-26 17:43 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [] + + operations = [ + migrations.CreateModel( + name="MyModel", + fields=[ + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("myfield", models.IntegerField()), + ], + ), + ] diff --git a/tests/test_project/app_data_migrations/migrations/0002_missing_reverse.py b/tests/test_project/app_data_migrations/migrations/0002_missing_reverse.py new file mode 100644 index 0000000..7d81139 --- /dev/null +++ b/tests/test_project/app_data_migrations/migrations/0002_missing_reverse.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2 on 2020-01-26 17:43 + +from django.db import migrations + + +def update_things(apps, schema_editor): + pass + + +class Migration(migrations.Migration): + + dependencies = [ + ("app_data_migrations", "0001_initial"), + ] + + operations = [ + migrations.RunPython(update_things), + ] diff --git a/tests/test_project/app_data_migrations/migrations/0003_incorrect_arguments.py b/tests/test_project/app_data_migrations/migrations/0003_incorrect_arguments.py new file mode 100644 index 0000000..ca8b548 --- /dev/null +++ b/tests/test_project/app_data_migrations/migrations/0003_incorrect_arguments.py @@ -0,0 +1,22 @@ +# Generated by Django 2.2 on 2020-01-26 17:47 + +from django.db import migrations + + +def backward_weirdly_named(david, test): + pass + + +def forward_weird_name(arg1, arg2): + pass + + +class Migration(migrations.Migration): + + dependencies = [ + ("app_data_migrations", "0002_missing_reverse"), + ] + + operations = [ + migrations.RunPython(forward_weird_name, backward_weirdly_named), + ] diff --git a/tests/test_project/app_data_migrations/migrations/__init__.py b/tests/test_project/app_data_migrations/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_project/app_data_migrations/models.py b/tests/test_project/app_data_migrations/models.py new file mode 100644 index 0000000..9ca985e --- /dev/null +++ b/tests/test_project/app_data_migrations/models.py @@ -0,0 +1,5 @@ +from django.db import models + + +class MyModel(models.Model): + myfield = models.IntegerField() diff --git a/tests/test_project/app_data_migrations/tests.py b/tests/test_project/app_data_migrations/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/tests/test_project/app_data_migrations/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/tests/test_project/app_data_migrations/views.py b/tests/test_project/app_data_migrations/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/tests/test_project/app_data_migrations/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here.