Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Oct 19, 2024
1 parent c32e3bb commit 9ee8328
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion auctions/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2787,7 +2787,7 @@ def high_bid(self):
except:
return 0
else:
if self.auction.online_bidding == "buy_now_only" and not self.bids:
if self.auction and self.auction.online_bidding == "buy_now_only" and not self.bids:
if self.buy_now_price:
return self.buy_now_price
return ""
Expand Down
2 changes: 1 addition & 1 deletion auctions/templates/lot_tile_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ <h5>You've already seen all your recommended lots</h5>
<div style='float: right; overflow: hidden;'>{% if lot.donation %}Donation{% else %}{% if lot.auction.is_online or not lot.auction %} {{ lot.seller_as_str }}{% endif %}{% endif %}</div></div>

<div class="card-body">
<h5 class="card-title" data-toggle="tooltip" data-placement="bottom" data-html="true" title="{{ lot.description_rendered }}Quantity: {{lot.quantity}}">{{ lot.lot_name }}</h5>
<h5 class="card-title">{{ lot.lot_name }}</h5>
{% if not lot.auction.ended and lot.sold %}<h1 class='text-danger font-weight-bold' style="position: absolute;-ms-transform: rotate(-20deg);transform: rotate(-20deg);">SOLD</h1>{%endif%}
{% if lot.thumbnail %}<img class="card-img-top" src="{{ lot.thumbnail.image.lot_list.url }}" style="max-width:100%;"></img>{% endif %}
<p class="card-text">
Expand Down
9 changes: 9 additions & 0 deletions auctions/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,18 @@ def test_no_bidding_on_your_own_lots(self):
response = self.client.get(self.url)
self.assertContains(response, "You can't bid on your own lot")

def test_with_tos_on_ended_lot(self):
AuctionTOS.objects.create(user=self.userB, auction=self.auction, pickup_location=self.location)
self.client.login(username="no_tos", password="testpassword")
response = self.client.get(self.url)
self.assertContains(response, "Bidding has ended on this lot")

def test_with_tos_on_new_lot(self):
AuctionTOS.objects.create(user=self.userB, auction=self.auction, pickup_location=self.location)
self.client.login(username="no_tos", password="testpassword")
lot = Lot.objects.filter(pk=self.lot.pk).first()
lot.date_end = timezone.now() + datetime.timedelta(days=1)
lot.save()
response = self.client.get(self.url)
self.assertContains(response, "This lot is very new")

Expand Down

0 comments on commit 9ee8328

Please sign in to comment.