Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
31eac71a
Kaydet (Commit)
31eac71a
authored
May 09, 2014
tarafından
Andrew Godwin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
[1.7.x] Tests for #22325
üst
1e8b1db0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
0 deletions
+53
-0
test_executor.py
tests/migrations/test_executor.py
+22
-0
0001_initial.py
tests/migrations/test_migrations_custom_user/0001_initial.py
+31
-0
__init__.py
tests/migrations/test_migrations_custom_user/__init__.py
+0
-0
No files found.
tests/migrations/test_executor.py
Dosyayı görüntüle @
31eac71a
...
...
@@ -167,3 +167,25 @@ class ExecutorTests(MigrationTestBase):
executor
.
migrate
([(
"migrations"
,
None
)])
self
.
assertTableNotExists
(
"migrations_author"
)
self
.
assertTableNotExists
(
"migrations_tribble"
)
@override_settings
(
MIGRATION_MODULES
=
{
"migrations"
:
"migrations.test_migrations_custom_user"
},
AUTH_USER_MODEL
=
"migrations.Author"
,
)
def
test_custom_user
(
self
):
"""
Regression test for #22325 - references to a custom user model defined in the
same app are not resolved correctly.
"""
executor
=
MigrationExecutor
(
connection
)
self
.
assertTableNotExists
(
"migrations_author"
)
self
.
assertTableNotExists
(
"migrations_tribble"
)
# Migrate forwards
executor
.
migrate
([(
"migrations"
,
"0001_initial"
)])
self
.
assertTableExists
(
"migrations_author"
)
self
.
assertTableExists
(
"migrations_tribble"
)
# And migrate back to clean up the database
executor
.
loader
.
build_graph
()
executor
.
migrate
([(
"migrations"
,
None
)])
self
.
assertTableNotExists
(
"migrations_author"
)
self
.
assertTableNotExists
(
"migrations_tribble"
)
tests/migrations/test_migrations_custom_user/0001_initial.py
0 → 100644
Dosyayı görüntüle @
31eac71a
# encoding: utf8
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
from
django.conf
import
settings
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
migrations
.
swappable_dependency
(
settings
.
AUTH_USER_MODEL
),
]
operations
=
[
migrations
.
CreateModel
(
"Author"
,
[
(
"id"
,
models
.
AutoField
(
primary_key
=
True
)),
(
"name"
,
models
.
CharField
(
max_length
=
255
)),
],
),
migrations
.
CreateModel
(
"Tribble"
,
[
(
"id"
,
models
.
AutoField
(
primary_key
=
True
)),
(
"author"
,
models
.
ForeignKey
(
to
=
settings
.
AUTH_USER_MODEL
,
to_field
=
"id"
)),
],
)
]
tests/migrations/test_migrations_custom_user/__init__.py
0 → 100644
Dosyayı görüntüle @
31eac71a
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment