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
1bdf1cb1
Kaydet (Commit)
1bdf1cb1
authored
Eki 11, 2014
tarafından
Claude Paroz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Updated gis_migrations tests
üst
e50e0ee2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
17 deletions
+12
-17
0001_initial.py
...ntrib/gis/tests/gis_migrations/migrations/0001_initial.py
+2
-2
test_commands.py
django/contrib/gis/tests/gis_migrations/test_commands.py
+10
-15
No files found.
django/contrib/gis/tests/gis_migrations/migrations/0001_initial.py
Dosyayı görüntüle @
1bdf1cb1
...
...
@@ -22,7 +22,7 @@ class Migration(migrations.Migration):
name
=
'Household'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
verbose_name
=
'ID'
,
serialize
=
False
,
auto_created
=
True
,
primary_key
=
True
)),
(
'neighborhood'
,
models
.
ForeignKey
(
to
=
'gis.Neighborhood'
,
to_field
=
'id'
,
null
=
True
)),
(
'neighborhood'
,
models
.
ForeignKey
(
to
=
'gis
_migrations
.Neighborhood'
,
to_field
=
'id'
,
null
=
True
)),
(
'address'
,
models
.
CharField
(
max_length
=
100
)),
(
'zip_code'
,
models
.
IntegerField
(
null
=
True
,
blank
=
True
)),
(
'geom'
,
django
.
contrib
.
gis
.
db
.
models
.
fields
.
PointField
(
srid
=
4326
,
geography
=
True
)),
...
...
@@ -44,7 +44,7 @@ class Migration(migrations.Migration):
migrations
.
AddField
(
model_name
=
'household'
,
name
=
'family'
,
field
=
models
.
ForeignKey
(
blank
=
True
,
to
=
'gis.Family'
,
null
=
True
),
field
=
models
.
ForeignKey
(
blank
=
True
,
to
=
'gis
_migrations
.Family'
,
null
=
True
),
preserve_default
=
True
,
),
]
django/contrib/gis/tests/gis_migrations/test_commands.py
Dosyayı görüntüle @
1bdf1cb1
...
...
@@ -12,7 +12,7 @@ class MigrateTests(TransactionTestCase):
"""
Tests running the migrate command in Geodjango.
"""
available_apps
=
[
"django.contrib.gis"
]
available_apps
=
[
"django.contrib.gis
.tests.gis_migrations
"
]
def
get_table_description
(
self
,
table
):
with
connection
.
cursor
()
as
cursor
:
...
...
@@ -26,7 +26,6 @@ class MigrateTests(TransactionTestCase):
with
connection
.
cursor
()
as
cursor
:
self
.
assertNotIn
(
table
,
connection
.
introspection
.
table_names
(
cursor
))
@override_settings
(
MIGRATION_MODULES
=
{
"gis"
:
"django.contrib.gis.tests.gis_migrations.migrations"
})
def
test_migrate_gis
(
self
):
"""
Tests basic usage of the migrate command when a model uses Geodjango
...
...
@@ -38,22 +37,16 @@ class MigrateTests(TransactionTestCase):
failure on geometry_columns. Regression for ticket #23030:
https://code.djangoproject.com/ticket/23030
"""
# Make sure no tables are created
self
.
assertTableNotExists
(
"migrations_neighborhood"
)
self
.
assertTableNotExists
(
"migrations_household"
)
self
.
assertTableNotExists
(
"migrations_family"
)
# Run the migrations to 0001 only
call_command
(
"migrate"
,
"gis"
,
"0001"
,
verbosity
=
0
)
# Make sure the right tables exist
self
.
assertTableExists
(
"gis_neighborhood"
)
self
.
assertTableExists
(
"gis_household"
)
self
.
assertTableExists
(
"gis_family"
)
self
.
assertTableExists
(
"gis_
migrations_
neighborhood"
)
self
.
assertTableExists
(
"gis_
migrations_
household"
)
self
.
assertTableExists
(
"gis_
migrations_
family"
)
# Unmigrate everything
call_command
(
"migrate"
,
"gis"
,
"zero"
,
verbosity
=
0
)
call_command
(
"migrate"
,
"gis
_migrations
"
,
"zero"
,
verbosity
=
0
)
# Make sure it's all gone
self
.
assertTableNotExists
(
"gis_neighborhood"
)
self
.
assertTableNotExists
(
"gis_household"
)
self
.
assertTableNotExists
(
"gis_family"
)
self
.
assertTableNotExists
(
"gis_
migrations_
neighborhood"
)
self
.
assertTableNotExists
(
"gis_
migrations_
household"
)
self
.
assertTableNotExists
(
"gis_
migrations_
family"
)
# Even geometry columns metadata
try
:
GeoColumn
=
connection
.
ops
.
geometry_columns
()
...
...
@@ -66,3 +59,5 @@ class MigrateTests(TransactionTestCase):
**
{
'
%
s__in'
%
GeoColumn
.
table_name_col
():
[
"gis_neighborhood"
,
"gis_household"
]}
)
.
count
(),
0
)
# Revert the "unmigration"
call_command
(
"migrate"
,
"gis_migrations"
,
verbosity
=
0
)
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