fix linting
This commit is contained in:
@@ -12,20 +12,20 @@ def sample_address():
|
|||||||
:return: tuple of Address
|
:return: tuple of Address
|
||||||
"""
|
"""
|
||||||
address1 = Address.objects.create(
|
address1 = Address.objects.create(
|
||||||
number = 22,
|
number=22,
|
||||||
street = "Quality Street",
|
street="Quality Street",
|
||||||
city = "New-York",
|
city="New-York",
|
||||||
state = "New-York",
|
state="New-York",
|
||||||
zip_code = 10010,
|
zip_code=10010,
|
||||||
country_iso_code = "US"
|
country_iso_code="US"
|
||||||
)
|
)
|
||||||
address2 = Address.objects.create(
|
address2 = Address.objects.create(
|
||||||
number = 18,
|
number=18,
|
||||||
street = "Rue Cocotte",
|
street="Rue Cocotte",
|
||||||
city = "Paris",
|
city="Paris",
|
||||||
state = "Ile-de-France",
|
state="Ile-de-France",
|
||||||
zip_code = 75000,
|
zip_code=75000,
|
||||||
country_iso_code = "FR"
|
country_iso_code="FR"
|
||||||
)
|
)
|
||||||
return address1, address2
|
return address1, address2
|
||||||
|
|
||||||
@@ -38,12 +38,12 @@ def sample_letting(sample_address):
|
|||||||
:return: tuple of Lettings
|
:return: tuple of Lettings
|
||||||
"""
|
"""
|
||||||
letting = Letting.objects.create(
|
letting = Letting.objects.create(
|
||||||
title = "Pretty thing",
|
title="Pretty thing",
|
||||||
address = sample_address[0],
|
address=sample_address[0],
|
||||||
)
|
)
|
||||||
letting2 = Letting.objects.create(
|
letting2 = Letting.objects.create(
|
||||||
title = "Ugly thing",
|
title="Ugly thing",
|
||||||
address = sample_address[1],
|
address=sample_address[1],
|
||||||
)
|
)
|
||||||
|
|
||||||
return letting, letting2
|
return letting, letting2
|
||||||
@@ -57,16 +57,16 @@ def sample_profile():
|
|||||||
:return: tuple of Profiles
|
:return: tuple of Profiles
|
||||||
"""
|
"""
|
||||||
user = User.objects.create(
|
user = User.objects.create(
|
||||||
username = 'TestUser',
|
username='TestUser',
|
||||||
password = 'password',
|
password='password',
|
||||||
)
|
)
|
||||||
user2 = User.objects.create(
|
user2 = User.objects.create(
|
||||||
username = 'TestUser2',
|
username='TestUser2',
|
||||||
password = 'password2',
|
password='password2',
|
||||||
)
|
)
|
||||||
user3 = User.objects.create(
|
user3 = User.objects.create(
|
||||||
username = 'TestUser3',
|
username='TestUser3',
|
||||||
password = 'password2',
|
password='password2',
|
||||||
)
|
)
|
||||||
profile = Profile.objects.create(
|
profile = Profile.objects.create(
|
||||||
user=user,
|
user=user,
|
||||||
|
|||||||
@@ -6,12 +6,11 @@ from profiles.models import Profile
|
|||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_str_profile():
|
def test_str_profile():
|
||||||
user = User.objects.create(
|
user = User.objects.create(
|
||||||
username = 'TestUser',
|
username='TestUser',
|
||||||
password = 'password',
|
password='password',
|
||||||
)
|
)
|
||||||
profile = Profile.objects.create(
|
profile = Profile.objects.create(
|
||||||
user=user,
|
user=user,
|
||||||
favorite_city="Paris",
|
favorite_city="Paris",
|
||||||
|
|
||||||
)
|
)
|
||||||
assert str(profile) == "TestUser"
|
assert str(profile) == "TestUser"
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ def test_should_get_200_on_profile_index():
|
|||||||
response = c.get(url)
|
response = c.get(url)
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_should_get_200_on_profile_detail(sample_profile):
|
def test_should_get_200_on_profile_detail(sample_profile):
|
||||||
""" test the server's response on a profile detail page """
|
""" test the server's response on a profile detail page """
|
||||||
@@ -18,4 +19,3 @@ def test_should_get_200_on_profile_detail(sample_profile):
|
|||||||
url = reverse('profile', kwargs={'username': "TestUser"})
|
url = reverse('profile', kwargs={'username': "TestUser"})
|
||||||
response = c.get(url)
|
response = c.get(url)
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ from django.test import Client
|
|||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_view_should_display_right_len_list(sample_profile):
|
def test_view_should_display_right_len_list(sample_profile):
|
||||||
"""
|
"""
|
||||||
@@ -15,4 +16,3 @@ def test_view_should_display_right_len_list(sample_profile):
|
|||||||
soup = BeautifulSoup(response.content, 'html.parser')
|
soup = BeautifulSoup(response.content, 'html.parser')
|
||||||
li_tags = soup.find_all('li')
|
li_tags = soup.find_all('li')
|
||||||
assert len(li_tags) == 3
|
assert len(li_tags) == 3
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user