Skip to content

Commit

Permalink
Merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-Jess committed Oct 29, 2023
2 parents 6a02b11 + 08f9b2d commit 27b971c
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions backend/tests/sublet/test_sublets.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,17 @@ def test_update_sublet(self):
"end_date": "2024-08-07",
"amenities": ["Amenity1", "Amenity2"],
}
self.client.post("/sublet/properties/", payload)
test_sublet = Sublet.objects.get(subletter=self.user, title="Test Sublet2")
response = self.client.post("/sublet/properties/", payload)
old_id = json.loads(response.content)["id"]
# Update the sublet using the serializer
data = {"title": "New Title", "beds": 3}

response = self.client.patch(f"/sublet/properties/{str(test_sublet.id)}/", data)
data = {"title": "New Title", "beds": 3, "amenities": ["Amenity1"]}
response = self.client.patch(f"/sublet/properties/{str(old_id)}/", data)
res_json = json.loads(response.content)
self.assertEqual(3, res_json["beds"])
self.assertIsNotNone(Sublet.objects.get(subletter=self.user, title="New Title"))
self.assertEqual(old_id, Sublet.objects.all().last().id)
self.assertEqual("New Title", Sublet.objects.get(id=old_id).title)
self.assertEqual("New Title", res_json["title"])
self.assertEqual(1, len(res_json["amenities"]))

def test_browse_sublets(self):
response = self.client.get("/sublet/properties/")
Expand All @@ -96,15 +97,16 @@ def test_browse_sublets(self):
"end_date": "2024-08-07",
"amenities": ["Amenity1", "Amenity2"],
}
self.client.post("/sublet/properties/", payload)
response = self.client.post("/sublet/properties/", payload)
old_id = json.loads(response.content)["id"]
response = self.client.get("/sublet/properties/")
res_json = json.loads(response.content)
self.assertEqual(1 + first_length, len(res_json))
sublet = res_json[-1]
self.assertEqual(sublet["title"], "Test Sublet1")
self.assertEqual(sublet["address"], "1234 Test Street")
self.assertEqual(sublet["beds"], 2)
self.assertEqual(sublet["baths"], 1)
self.assertEqual(1+first_length, len(res_json))
sublet = Sublet.objects.get(id=old_id)
self.assertEqual(sublet.title, "Test Sublet1")
self.assertEqual(sublet.address, "1234 Test Street")
self.assertEqual(sublet.beds, 2)
self.assertEqual(sublet.baths, 1)

def test_browse_sublet(self):
# browse single sublet by id
Expand Down

0 comments on commit 27b971c

Please sign in to comment.