Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/368467 )

Change subject: WIP fix export for contacts with no donations
......................................................................

WIP fix export for contacts with no donations

Test only so far, with debugging code to print actual row

Bug: T171920
Change-Id: I03f362549707b21b1258af8733d6a84c4e343c44
---
M silverpop_export/tests/test_update.py
1 file changed, 22 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/tools 
refs/changes/67/368467/1

diff --git a/silverpop_export/tests/test_update.py 
b/silverpop_export/tests/test_update.py
index ef17da0..0c404b8 100644
--- a/silverpop_export/tests/test_update.py
+++ b/silverpop_export/tests/test_update.py
@@ -64,6 +64,28 @@
     assert cursor.fetchone() == (1,)
 
 
+def test_no_donations():
+    '''
+    Test that we set the donation-related fields correctly when a contact has
+    no donations.
+    '''
+
+    run_update_with_fixtures(fixture_queries=["""
+    insert into civicrm_email (contact_id, email, is_primary, on_hold) values
+        (1, 'person1@localhost', 1, 0);
+    """, """
+    insert into civicrm_contact (id) values
+        (1);
+    """])
+
+    cursor = conn.db_conn.cursor()
+    cursor.execute("select highest_usd_amount, lifetime_usd_total, 
donation_count, latest_currency, latest_native_amount, latest_usd_amount, 
latest_donation from silverpop_export")
+    actual = cursor.fetchone()
+    print(actual)
+    expected = (None, None, None, None, None, None, None)
+    assert actual == expected
+
+
 def test_refund_history():
     '''
     Test that we don't include refunded donations in a donor's history

-- 
To view, visit https://gerrit.wikimedia.org/r/368467
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I03f362549707b21b1258af8733d6a84c4e343c44
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/tools
Gerrit-Branch: master
Gerrit-Owner: Ejegg <ej...@ejegg.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to