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
ac45f9c9
Kaydet (Commit)
ac45f9c9
authored
Agu 23, 2013
tarafından
Andrew Godwin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix some small errors in the tests
üst
beefac8a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
10 deletions
+18
-10
test_base.py
tests/migrations/test_base.py
+4
-2
test_executor.py
tests/migrations/test_executor.py
+5
-0
test_operations.py
tests/migrations/test_operations.py
+7
-6
tests.py
tests/schema/tests.py
+2
-2
No files found.
tests/migrations/test_base.py
Dosyayı görüntüle @
ac45f9c9
from
django.test
import
TestCase
from
django.test
import
T
ransactionT
estCase
from
django.db
import
connection
class
MigrationTestBase
(
TestCase
):
class
MigrationTestBase
(
T
ransactionT
estCase
):
"""
Contains an extended set of asserts for testing migrations and schema operations.
"""
available_apps
=
[
"migrations"
]
def
assertTableExists
(
self
,
table
):
self
.
assertIn
(
table
,
connection
.
introspection
.
get_table_list
(
connection
.
cursor
()))
...
...
tests/migrations/test_executor.py
Dosyayı görüntüle @
ac45f9c9
...
...
@@ -38,6 +38,11 @@ class ExecutorTests(TransactionTestCase):
# Are the tables there now?
self
.
assertIn
(
"migrations_author"
,
connection
.
introspection
.
get_table_list
(
connection
.
cursor
()))
self
.
assertIn
(
"migrations_book"
,
connection
.
introspection
.
get_table_list
(
connection
.
cursor
()))
# Alright, let's undo what we did
executor
.
migrate
([(
"migrations"
,
None
)])
# Are the tables gone?
self
.
assertNotIn
(
"migrations_author"
,
connection
.
introspection
.
get_table_list
(
connection
.
cursor
()))
self
.
assertNotIn
(
"migrations_book"
,
connection
.
introspection
.
get_table_list
(
connection
.
cursor
()))
@override_settings
(
MIGRATION_MODULES
=
{
"migrations"
:
"migrations.test_migrations"
,
"sessions"
:
"migrations.test_migrations_2"
})
def
test_empty_plan
(
self
):
...
...
tests/migrations/test_operations.py
Dosyayı görüntüle @
ac45f9c9
...
...
@@ -127,12 +127,13 @@ class OperationTests(MigrationTestBase):
self
.
assertTableExists
(
"test_adflmm_pony_stables"
)
self
.
assertColumnNotExists
(
"test_adflmm_pony"
,
"stables"
)
# Make sure the M2M field actually works
app_cache
=
new_state
.
render
()
Pony
=
app_cache
.
get_model
(
"test_adflmm"
,
"Pony"
)
p
=
Pony
.
objects
.
create
(
pink
=
False
,
weight
=
4.55
)
p
.
stables
.
create
()
self
.
assertEqual
(
p
.
stables
.
count
(),
1
)
p
.
stables
.
all
()
.
delete
()
with
atomic
():
app_cache
=
new_state
.
render
()
Pony
=
app_cache
.
get_model
(
"test_adflmm"
,
"Pony"
)
p
=
Pony
.
objects
.
create
(
pink
=
False
,
weight
=
4.55
)
p
.
stables
.
create
()
self
.
assertEqual
(
p
.
stables
.
count
(),
1
)
p
.
stables
.
all
()
.
delete
()
# And test reversal
with
connection
.
schema_editor
()
as
editor
:
operation
.
database_backwards
(
"test_adflmm"
,
editor
,
new_state
,
project_state
)
...
...
tests/schema/tests.py
Dosyayı görüntüle @
ac45f9c9
...
...
@@ -195,7 +195,7 @@ class SchemaTests(TransactionTestCase):
# Ensure the field is right afterwards
columns
=
self
.
column_classes
(
Author
)
self
.
assertEqual
(
columns
[
'name'
][
0
],
"TextField"
)
self
.
assertEqual
(
columns
[
'name'
][
1
][
6
],
bool
(
connection
.
features
.
interprets_empty_strings_as_nulls
)
)
self
.
assertEqual
(
bool
(
columns
[
'name'
][
1
][
6
]),
False
)
def
test_rename
(
self
):
"""
...
...
@@ -230,7 +230,7 @@ class SchemaTests(TransactionTestCase):
# Create the tables
with
connection
.
schema_editor
()
as
editor
:
editor
.
create_model
(
Author
)
editor
.
create_model
(
Tag
)
editor
.
create_model
(
Tag
M2MTest
)
editor
.
create_model
(
BookWithM2M
)
# Ensure there is now an m2m table there
columns
=
self
.
column_classes
(
BookWithM2M
.
_meta
.
get_field_by_name
(
"tags"
)[
0
]
.
rel
.
through
)
...
...
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