def _make_content(self, bids_dict, recipients_notified, elapsed_secs): doc, tag, text = Doc().tagtext() with tag('p'): text("New bids found:") with tag('ul'): for site, bids in bids_dict.items(): with tag('li'): text("{}: {} new bids".format(site.value, len(bids))) with tag('p'): obfuscated_emails = [self._obfuscate_email( e) for e in recipients_notified] text("Notifications were sent to {}".format( ", ".join(obfuscated_emails))) with tag('p'): text("Total time elapsed: {}m {}sec".format(int(elapsed_secs / 60), elapsed_secs % 60)) with tag('p'): text("Current database contents:") with tag('ul'): bid_count = bid.get_bid_count_per_site(self.db_session) for site, count in bid_count.items(): with tag('li'): text("{}: {} total bids".format(site.value, count)) return doc.getvalue()
def _make_content(self, records_dict, config_used, elapsed_secs): doc, tag, text = Doc().tagtext() with tag('p'): text("New records found:") with tag('ul'): for site, records in records_dict.items(): with tag('li'): text("{}: {} new records".format( site.value, len(records))) with tag('p'): text("Notifications were sent to:") with tag('ul'): for site in records_dict.keys(): obfuscated_emails = [self._obfuscate_email( e) for e in config_used[site]['recipients']] with tag('li'): text("{}: {}".format(site.value, ", ".join(obfuscated_emails))) with tag('p'): text("Total time elapsed: {}m {}sec".format(int(elapsed_secs / 60), elapsed_secs % 60)) with tag('p'): text("Current database contents:") with tag('ul'): record_count = bid.get_bid_count_per_site(self.db_session) record_count.update( document.get_doc_count_per_site(self.db_session)) for site, count in record_count.items(): with tag('li'): text("{}: {} total records".format(site.value, count)) return doc.getvalue()
def test_get_bid_count_per_site(self): # Make sure the database contains at least one bid for each Site [factories.BidFactory(site=s.name) for s in Bid.Site] count_dict = get_bid_count_per_site(self.session) for site in Bid.Site: assert site in count_dict assert count_dict[site] > 0
def test_get_bid_count_per_site(self): count_dict = get_bid_count_per_site(self.session) for site in Bid.Site: assert site in count_dict assert count_dict[site] > 0