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
273bc4b6
Kaydet (Commit)
273bc4b6
authored
Şub 13, 2015
tarafından
Markus Holtermann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #24282 -- Added failing test case for assigning models of wrong type to FK
Thanks Jeff Singer for the test case.
üst
cc22b009
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
0 deletions
+54
-0
test_operations.py
tests/migrations/test_operations.py
+54
-0
No files found.
tests/migrations/test_operations.py
Dosyayı görüntüle @
273bc4b6
...
@@ -1659,6 +1659,60 @@ class OperationTests(OperationTestBase):
...
@@ -1659,6 +1659,60 @@ class OperationTests(OperationTestBase):
self
.
assertEqual
(
definition
[
1
],
[])
self
.
assertEqual
(
definition
[
1
],
[])
self
.
assertEqual
(
sorted
(
definition
[
2
]),
[
"atomic"
,
"code"
])
self
.
assertEqual
(
sorted
(
definition
[
2
]),
[
"atomic"
,
"code"
])
def
test_run_python_related_assignment
(
self
):
"""
#24282 - Tests that model changes to a FK reverse side update the model
on the FK side as well.
"""
def
inner_method
(
models
,
schema_editor
):
Author
=
models
.
get_model
(
"test_authors"
,
"Author"
)
Book
=
models
.
get_model
(
"test_books"
,
"Book"
)
author
=
Author
.
objects
.
create
(
name
=
"Hemingway"
)
Book
.
objects
.
create
(
title
=
"Old Man and The Sea"
,
author
=
author
)
create_author
=
migrations
.
CreateModel
(
"Author"
,
[
(
"id"
,
models
.
AutoField
(
primary_key
=
True
)),
(
"name"
,
models
.
CharField
(
max_length
=
100
)),
],
options
=
{},
)
create_book
=
migrations
.
CreateModel
(
"Book"
,
[
(
"id"
,
models
.
AutoField
(
primary_key
=
True
)),
(
"title"
,
models
.
CharField
(
max_length
=
100
)),
(
"author"
,
models
.
ForeignKey
(
"test_authors.Author"
))
],
options
=
{},
)
add_hometown
=
migrations
.
AddField
(
"Author"
,
"hometown"
,
models
.
CharField
(
max_length
=
100
),
)
create_old_man
=
migrations
.
RunPython
(
inner_method
,
inner_method
)
project_state
=
ProjectState
()
new_state
=
project_state
.
clone
()
with
connection
.
schema_editor
()
as
editor
:
create_author
.
state_forwards
(
"test_authors"
,
new_state
)
create_author
.
database_forwards
(
"test_authors"
,
editor
,
project_state
,
new_state
)
project_state
=
new_state
new_state
=
new_state
.
clone
()
create_book
.
state_forwards
(
"test_books"
,
new_state
)
create_book
.
database_forwards
(
"test_books"
,
editor
,
project_state
,
new_state
)
project_state
=
new_state
new_state
=
new_state
.
clone
()
add_hometown
.
state_forwards
(
"test_authors"
,
new_state
)
add_hometown
.
database_forwards
(
"test_authors"
,
editor
,
project_state
,
new_state
)
project_state
=
new_state
new_state
=
new_state
.
clone
()
create_old_man
.
state_forwards
(
"test_books"
,
new_state
)
create_old_man
.
database_forwards
(
"test_books"
,
editor
,
project_state
,
new_state
)
def
test_run_python_noop
(
self
):
def
test_run_python_noop
(
self
):
"""
"""
#24098 - Tests no-op RunPython operations.
#24098 - Tests no-op RunPython operations.
...
...
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