diff --git a/caravel/templates/listing_form.html b/caravel/templates/listing_form.html
index 7291bd2..4add4c3 100644
--- a/caravel/templates/listing_form.html
+++ b/caravel/templates/listing_form.html
@@ -17,12 +17,10 @@
{% if form.principal %}
{{ wtf.form_field(form.principal) }}
{% endif %}
-
- BSD/Medicine/Medical School affiliates: if you are unable to sign
- in with your CNetID, please enter your email in the box. Your
- listing might not be posted immediately. We reserve the right to
- remove listings at any time.
-
+ Alumni/BSD/Medicine/Medical School affiliates: if you are unable
+ to sign in with your CNetID, please enter your email in the box.
+ Your listing might not be posted immediately. We reserve the right
+ to remove listings at any time.
{{ wtf.form_field(form.categories) }}
{{ wtf.form_field(form.price) }}
{{ wtf.form_field(form.body) }}
diff --git a/caravel/templates/listings/fullpage.html b/caravel/templates/listings/fullpage.html
index 5a5ccf6..14eef71 100644
--- a/caravel/templates/listings/fullpage.html
+++ b/caravel/templates/listings/fullpage.html
@@ -23,13 +23,13 @@ {{ listing.title }}
{{ category }}
{% endfor %}
- Posted {{ listing.posted_at|as_duration }}
- by {% if current_user %}
+
Posted {{ listing.posted_at|as_duration }}.
+ {# by {% if current_user %}
{{ listing.principal.email }}
{%- else -%}
[address hidden] (sign in to view)
- {%- endif -%}.
+ {%- endif -%}. #}
Price: {{ '${:,.2f}'.format(listing.price) }}
{% if is_admin %}
diff --git a/caravel/templates/listings/thumbnail.html b/caravel/templates/listings/thumbnail.html
index 058aa64..f34a80b 100644
--- a/caravel/templates/listings/thumbnail.html
+++ b/caravel/templates/listings/thumbnail.html
@@ -27,9 +27,9 @@
{% for category in listing.categories %}
{{ category }}
{% endfor %}
- {% if current_user %}
+ {# }{% if current_user %}
{{ listing.principal.email }}
- {% endif %}
+ {% endif %} #}
{{
listing.posted_at|as_duration }}
diff --git a/caravel/tests/helper.py b/caravel/tests/helper.py
index 00436bb..b40b7ac 100644
--- a/caravel/tests/helper.py
+++ b/caravel/tests/helper.py
@@ -94,6 +94,7 @@ def clean(self, markup):
markup = re.sub(r'Marketplace is.*lists.uchicago.edu\. ', '', markup)
markup = re.sub(r'(^.*UChicago Marketplace)|(©.*$)', '', markup)
markup = re.sub(r'Please .* Update to Marketplace \. ', '', markup)
+ markup = re.sub(r'Alumni/BSD.*?any time\. ', '', markup)
return markup.strip()
def extract_photos(self, markup):
diff --git a/caravel/tests/test_listings.py b/caravel/tests/test_listings.py
index b0d3f00..5c932b4 100644
--- a/caravel/tests/test_listings.py
+++ b/caravel/tests/test_listings.py
@@ -7,10 +7,14 @@
import time
import re
+
class TestListings(helper.CaravelTestCase):
+
def test_search(self):
# View all listings, in order.
- self.assertEqual(self.clean(self.get("/").data),
+ self.assertEqual(
+ self.clean(
+ self.get("/").data),
"New Listing Listing \xe2\x98\x86A $3.10 cars 5h ago Listing "
"\xe2\x98\x86B $71.10 apartments 2d ago")
@@ -21,12 +25,14 @@ def test_search(self):
"apartments")
# Listings at an offset.
- self.assertEqual(self.clean(self.get("/?offset=1").data),
+ self.assertEqual(
+ self.clean(
+ self.get("/?offset=1").data),
"New Listing Listing \xe2\x98\x86B $71.10 apartments 2d ago")
# Just a subset of listings.
self.assertEqual(self.clean(self.get("/?q=body+%E2%98%86a").data),
- "New Listing Listing \xe2\x98\x86A $3.10 cars 5h ago")
+ "New Listing Listing \xe2\x98\x86A $3.10 cars 5h ago")
# Make sure links work.
self.assertIn("/listing_a", self.get("/?q=body+%E2%98%86a").data)
@@ -47,10 +53,12 @@ def test_post_inquiry(self):
})
# Even so, ensure that it seems as though it got through.
- self.assertEqual(self.clean(self.get("/listing_b").data),
+ self.assertEqual(
+ self.clean(
+ self.get("/listing_b").data),
"New Listing Your inquiry has been recorded and is awaiting "
- "moderation. Listing \xe2\x98\x86B apartments Posted 2d ago by "
- "[address hidden] ( sign in to view). Price: $71.10 Body of "
+ "moderation. Listing \xe2\x98\x86B apartments Posted 2d ago . "
+ "Price: $71.10 Body of "
"\xe2\x98\x86B Contact Seller From Sign in with CNetID or Message")
# Ensure that no emails have been sent.
@@ -60,20 +68,22 @@ def test_post_inquiry(self):
self.get("/_internal/nag_moderators")
# Ensure that the moderators received the right email.
- self.assertEqual(self.emails[0].to[0], "marketplace@lists.uchicago.edu")
- self.assertEqual(self.emails[0].from_email,
+ self.assertEqual(
+ self.emails[0].to[0],
"marketplace@lists.uchicago.edu")
+ self.assertEqual(self.emails[0].from_email,
+ "marketplace@lists.uchicago.edu")
self.assertEqual(self.emails[0].subject,
- u"1 Inquiries, 0 Listings Pending")
+ u"1 Inquiries, 0 Listings Pending")
- self.assertEqual(self.emails[0].text,
+ self.assertEqual(
+ self.emails[0].text,
u"Greetings,\n"
u"\n"
u"Please visit http://localhost/moderation to approve things.\n"
u"\n"
u"Inquiries (1):\n"
- u" Listing \u2606B (buyer@foo.com)\n"
- )
+ u" Listing \u2606B (buyer@foo.com)\n")
self.emails.pop(0)
# Approve the first listing.
@@ -87,12 +97,13 @@ def test_post_inquiry(self):
self.assertEqual(self.emails[0].to[0], "seller-b@uchicago.edu")
self.assertEqual(self.emails[0].reply_to, "buyer@foo.com")
self.assertEqual(self.emails[0].from_email,
- "marketplace@lists.uchicago.edu")
+ "marketplace@lists.uchicago.edu")
self.assertEqual(self.emails[0].subject,
- u"Re: Marketplace Listing \"Listing \u2606B\"")
+ u"Re: Marketplace Listing \"Listing \u2606B\"")
# Verify that the right message text was sent.
- self.assertEqual(self.emails[0].text,
+ self.assertEqual(
+ self.emails[0].text,
u"Hello again!\n\n"
u"We've received a new inquiry for Listing \u2606B:\n\n"
u" Buyer: buyer@foo.com\n"
@@ -100,11 +111,12 @@ def test_post_inquiry(self):
u" message\u2606 goes here\n\n"
u"Simply reply to this email if you'd like to get in contact.\n\n"
u"Cheers,\n"
- u"The Marketplace Team"
- )
+ u"The Marketplace Team")
# Verify that the right messge HTML was sent.
- self.assertEqual(self.clean(self.emails[0].html),
+ self.assertEqual(
+ self.clean(
+ self.emails[0].html),
u"Marketplace "
u"Hello again! "
u"We've received a new inquiry for Listing \u2606B: "
@@ -123,10 +135,12 @@ def test_post_inquiry_with_cnetid(self):
})
# Ensure that we display a helpful message.
- self.assertEqual(self.clean(self.get("/listing_b").data),
+ self.assertEqual(
+ self.clean(
+ self.get("/listing_b").data),
"New Listing Logged in as visitor@uchicago.edu My Listings "
"Logout Your inquiry has been sent. Listing \xe2\x98\x86B "
- "apartments Posted 2d ago by seller-b@uchicago.edu . Price: "
+ "apartments Posted 2d ago . Price: "
"$71.10 Validated by GOOGLE_APPS. Originally posted by 1.2.3.4 "
"with mozilla. Body of \xe2\x98\x86B Contact Seller From "
"visitor@uchicago.edu ( Logout ) Message")
@@ -135,12 +149,13 @@ def test_post_inquiry_with_cnetid(self):
self.assertEqual(self.emails[0].to[0], "seller-b@uchicago.edu")
self.assertEqual(self.emails[0].reply_to, "visitor@uchicago.edu")
self.assertEqual(self.emails[0].from_email,
- "marketplace@lists.uchicago.edu")
+ "marketplace@lists.uchicago.edu")
self.assertEqual(self.emails[0].subject,
- u"Re: Marketplace Listing \"Listing \u2606B\"")
+ u"Re: Marketplace Listing \"Listing \u2606B\"")
# Verify that the right message text was sent.
- self.assertEqual(self.emails[0].text,
+ self.assertEqual(
+ self.emails[0].text,
u"Hello again!\n\n"
u"We've received a new inquiry for Listing \u2606B:\n\n"
u" Buyer: visitor@uchicago.edu\n"
@@ -148,11 +163,12 @@ def test_post_inquiry_with_cnetid(self):
u" message\u2606 goes here\n\n"
u"Simply reply to this email if you'd like to get in contact.\n\n"
u"Cheers,\n"
- u"The Marketplace Team"
- )
+ u"The Marketplace Team")
# Verify that the right messge HTML was sent.
- self.assertEqual(self.clean(self.emails[0].html),
+ self.assertEqual(
+ self.clean(
+ self.emails[0].html),
u"Marketplace "
u"Hello again! "
u"We've received a new inquiry for Listing \u2606B: "
@@ -175,13 +191,17 @@ def test_new_listing(self):
})
# Ensure that we get a message indicating that it does not exist.
- self.assertEqual(self.clean(self.get("/").data),
+ self.assertEqual(
+ self.clean(
+ self.get("/").data),
"New Listing Your listing is awaiting moderation. We'll email "
"you when it's up. Listing \xe2\x98\x86A $3.10 cars 5h ago "
"Listing \xe2\x98\x86B $71.10 apartments 2d ago")
# Ensure that the listing does not exist yet.
- self.assertEqual(self.clean(self.get("/ZZ-ZZ-ZZ").data),
+ self.assertEqual(
+ self.clean(
+ self.get("/ZZ-ZZ-ZZ").data),
"404 Not Found Not Found The requested URL was not found on the "
"server. If you entered the URL manually please check your "
"spelling and try again.")
@@ -197,9 +217,11 @@ def test_new_listing(self):
})
# Listing is now published.
- self.assertEqual(self.clean(self.get("/ZZ-ZZ-ZZ").data),
- "New Listing Title of \xe2\x98\x86D apartments Posted now by "
- "[address hidden] ( sign in to view). Price: $3.44 Body of "
+ self.assertEqual(
+ self.clean(
+ self.get("/ZZ-ZZ-ZZ").data),
+ "New Listing Title of \xe2\x98\x86D apartments Posted now . "
+ "Price: $3.44 Body of "
"\xe2\x98\x86D Contact Seller From Sign in with CNetID or Message")
# Make sure the picture shows up.
@@ -211,7 +233,9 @@ def test_new_listing(self):
])
# Listing shows up in searches.
- self.assertEqual(self.clean(self.get("/").data),
+ self.assertEqual(
+ self.clean(
+ self.get("/").data),
"New Listing Title of \xe2\x98\x86D $3.44 apartments now Listing "
"\xe2\x98\x86A $3.10 cars 5h ago Listing \xe2\x98\x86B $71.10 "
"apartments 2d ago")
@@ -242,10 +266,12 @@ def test_new_listing_with_cnetid(self):
})
# Listing is now published.
- self.assertEqual(self.clean(self.get("/ZZ-ZZ-ZZ").data),
+ self.assertEqual(
+ self.clean(
+ self.get("/ZZ-ZZ-ZZ").data),
"New Listing Logged in as visitor@uchicago.edu My Listings "
"Logout Your listing has been created. Title of \xe2\x98\x86D "
- "apartments Posted now by visitor@uchicago.edu . Price: $3.44 "
+ "apartments Posted now . Price: $3.44 "
"Validated by GOOGLE_APPS. Originally posted by None with . "
"Body of \xe2\x98\x86D Manage Listing Edit")
@@ -258,7 +284,9 @@ def test_new_listing_with_cnetid(self):
])
# Listing shows up in searches.
- self.assertEqual(self.clean(self.get("/").data),
+ self.assertEqual(
+ self.clean(
+ self.get("/").data),
"New Listing Title of \xe2\x98\x86D $3.44 apartments now Listing "
"\xe2\x98\x86A $3.10 cars 5h ago Listing \xe2\x98\x86B $71.10 "
"apartments 2d ago")
@@ -275,12 +303,13 @@ def test_new_listing_with_cnetid(self):
# Verify that the proper email was sent.
self.assertEqual(self.emails[0].to[0], "visitor@uchicago.edu")
self.assertEqual(self.emails[0].from_email,
- "marketplace@lists.uchicago.edu")
+ "marketplace@lists.uchicago.edu")
self.assertEqual(self.emails[0].subject,
- u"Marketplace Listing \"Title of \u2606D\"")
+ u"Marketplace Listing \"Title of \u2606D\"")
# Verify that the right message text was sent.
- self.assertEqual(self.emails[0].text,
+ self.assertEqual(
+ self.emails[0].text,
u"Hello there, and welcome to Marketplace!\n\n"
u"Your listing has been created. Please click the link below to "
u"edit it.\n\n"
@@ -289,12 +318,12 @@ def test_new_listing_with_cnetid(self):
u"\"Contact Seller\"\nform will come as a follow-up to this "
u"message. Users with CNetIDs can also\ncontact you directly.\n\n"
u"Cheers,\n"
- u"The Marketplace Team"
- )
+ u"The Marketplace Team")
# Verify that the right messge HTML was sent.
- self.assertEqual(self.clean(self.emails[0].html),
- u"Marketplace "
+ self.assertEqual(
+ self.clean(
+ self.emails[0].html), u"Marketplace "
u"Hello there, and welcome to Marketplace! "
u"Your listing has been created. Please click the button below to "
u"edit it. "
@@ -303,8 +332,7 @@ def test_new_listing_with_cnetid(self):
u"\"Contact Seller\" form will come as a follow-up to this "
u"message. Users with CNetIDs can also contact you directly. "
u"Cheers, "
- u"The Marketplace Team"
- )
+ u"The Marketplace Team")
def test_edit_listing(self):
# Try editing someone else's listing.
@@ -317,16 +345,12 @@ def test_edit_listing(self):
categories="cars",
)).data
- self.assertEqual(self.clean(result),
- "New Listing Title Seller Sign in with CNetID or Please sign in "
- "with your CNetID. BSD/Medicine/Medical School affiliates: if "
- "you are unable to sign in with your CNetID, please enter your "
- "email in the box. Your listing might not be posted immediately. "
- "We reserve the right to remove listings at any time. Categories "
+ self.assertEqual(
+ self.clean(result), "New Listing Title Seller Sign in "
+ "with CNetID or Please sign in with your CNetID. Categories "
"Apartments Subleases Appliances Bikes Books Cars Electronics "
"Employment Furniture Miscellaneous Services Wanted Price Body "
- "Body\xe2\x98\x86A Image Image Image Image Image Cancel"
- )
+ "Body\xe2\x98\x86A Image Image Image Image Image Cancel")
# Try editing our own listing.
with self.google_apps_user("seller-a@uchicago.edu"):
@@ -339,13 +363,14 @@ def test_edit_listing(self):
categories="cars",
))
- self.assertEqual(self.clean(self.get("/listing_a").data),
+ self.assertEqual(
+ self.clean(
+ self.get("/listing_a").data),
"New Listing Logged in as seller-a@uchicago.edu My Listings "
"Logout Your listing has been updated. Title\xe2\x98\x86A cars "
- "Posted now by seller-a@uchicago.edu . Price: $2.34 Validated "
+ "Posted now . Price: $2.34 Validated "
"by GOOGLE_APPS. Originally posted by None with . "
- "Body\xe2\x98\x86A Manage Listing Edit"
- )
+ "Body\xe2\x98\x86A Manage Listing Edit")
@unittest.skip("Claim listing features disabled")
def test_claim_listing(self):
@@ -355,7 +380,9 @@ def test_claim_listing(self):
))
# Ensure that the flash shows up.
- self.assertEqual(self.clean(self.get("/listing_a").data),
+ self.assertEqual(
+ self.clean(
+ self.get("/listing_a").data),
"New Listing We've emailed you a link to edit this listing. "
"Listing \xe2\x98\x86A Cars $3.10 Body of \xe2\x98\x86A Contact "
"Seller Email Sign in with CNetID or Message")
@@ -363,12 +390,13 @@ def test_claim_listing(self):
# Ensure that the message is as we expect.
self.assertEqual(self.emails[0].to[0], "seller-a@uchicago.edu")
self.assertEqual(self.emails[0].from_email,
- "marketplace@lists.uchicago.edu")
+ "marketplace@lists.uchicago.edu")
self.assertEqual(self.emails[0].subject,
- u"Marketplace Listing \"Listing \u2606A\"")
+ u"Marketplace Listing \"Listing \u2606A\"")
# Verify the textual contents of the message.
- self.assertEqual(self.emails[0].text,
+ self.assertEqual(
+ self.emails[0].text,
u"Hello there, and welcome to Marketplace!\n\n"
u"Your listing has been created. Please click the link below "
u"to edit it.\n\n"
@@ -382,7 +410,9 @@ def test_claim_listing(self):
u"The Marketplace Team")
# Verify that the email looks fine.
- self.assertEqual(self.clean(self.emails[0].html),
+ self.assertEqual(
+ self.clean(
+ self.emails[0].html),
u"Welcome to Marketplace Marketplace Hello there, and welcome to "
u"Marketplace! Your listing has been created. Please click the "
u"button below to edit it. Edit \"Listing \u2606A\" Important: "