Skip to content

Commit

Permalink
Merge 3e9bdeb into 6f5d8f1
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshu1196 committed Dec 13, 2023
2 parents 6f5d8f1 + 3e9bdeb commit 5a8630c
Showing 1 changed file with 43 additions and 7 deletions.
50 changes: 43 additions & 7 deletions rrapp/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,14 +607,50 @@ def test_logout_view(self):
self.assertEqual(response.status_code, 200)


class ListingNewViewTest(TestCase):
class ListingNewViewTest(ViewsTestCase):
def test_listing_new_view_post(self):
client = Client()
response = client.post(
reverse("rrapp:listing_new"),
{"title": "Test Listing", "monthly_rent": 1000},
)
self.assertEqual(response.status_code, 302)
self.client.force_login(self.user)
data = {
"status": "active",
"title": "Updated Listing",
"description": "Updated description",
"monthly_rent": 1000,
"date_available_from": "2021-01-01",
"date_available_to": "2077-12-31",
"property_type": "apartment",
"room_type": "shared",
"address1": "1234 Test St",
"address2": "Apt 1",
"zip_code": "12345",
"city": "New York",
"state": "NY",
"country": "US",
"washer": True,
"dryer": True,
"dishwasher": True,
"microwave": True,
"baking_oven": True,
"parking": True,
"number_of_bedrooms": 2,
"number_of_bathrooms": 2,
"furnished": True,
"utilities_included": True,
"lease_type": "new",
"age_range_0": 20,
"age_range_1": 30,
"smoking_allowed": True,
"pets_allowed": "all",
"food_groups_allowed": "all",
"preferred_gender": "female",
"restrict_to_matches": True,
"existing_photos": "[]",
"add_photos": "[]",
}
form = ListingForm(data)
response = self.client.post(reverse("rrapp:listing_new"), data)
print(form.errors)
self.assertTrue(form.is_valid())
self.assertIn(response.status_code, [200, 302])


class ProfileViewTest(TestCase): # TODO
Expand Down

0 comments on commit 5a8630c

Please sign in to comment.