style: move PlantCardPhoto import to module level in test_models
This commit is contained in:
parent
4132406f15
commit
3b8ebd6454
1 changed files with 1 additions and 4 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
import pytest
|
import pytest
|
||||||
from plants.models import Species, Plant, PruningLog, Location
|
from plants.models import Species, Plant, PruningLog, Location, PlantCardPhoto
|
||||||
from datetime import date
|
from datetime import date
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -57,7 +57,6 @@ def test_delete_species_nulls_plant_species():
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_card_photo_belongs_to_plant():
|
def test_card_photo_belongs_to_plant():
|
||||||
from plants.models import PlantCardPhoto
|
|
||||||
plant = Plant.objects.create(name='Test')
|
plant = Plant.objects.create(name='Test')
|
||||||
photo = PlantCardPhoto.objects.create(plant=plant, image='plants/cards/test.jpg')
|
photo = PlantCardPhoto.objects.create(plant=plant, image='plants/cards/test.jpg')
|
||||||
assert photo.plant == plant
|
assert photo.plant == plant
|
||||||
|
|
@ -65,7 +64,6 @@ def test_card_photo_belongs_to_plant():
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_card_photos_ordered_by_uploaded_at():
|
def test_card_photos_ordered_by_uploaded_at():
|
||||||
from plants.models import PlantCardPhoto
|
|
||||||
plant = Plant.objects.create(name='Test')
|
plant = Plant.objects.create(name='Test')
|
||||||
p1 = PlantCardPhoto.objects.create(plant=plant, image='plants/cards/a.jpg')
|
p1 = PlantCardPhoto.objects.create(plant=plant, image='plants/cards/a.jpg')
|
||||||
p2 = PlantCardPhoto.objects.create(plant=plant, image='plants/cards/b.jpg')
|
p2 = PlantCardPhoto.objects.create(plant=plant, image='plants/cards/b.jpg')
|
||||||
|
|
@ -76,7 +74,6 @@ def test_card_photos_ordered_by_uploaded_at():
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_card_photos_deleted_with_plant():
|
def test_card_photos_deleted_with_plant():
|
||||||
from plants.models import PlantCardPhoto
|
|
||||||
plant = Plant.objects.create(name='Test')
|
plant = Plant.objects.create(name='Test')
|
||||||
PlantCardPhoto.objects.create(plant=plant, image='plants/cards/test.jpg')
|
PlantCardPhoto.objects.create(plant=plant, image='plants/cards/test.jpg')
|
||||||
plant.delete()
|
plant.delete()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue