canvas-lms/db
Alex Boyd a3eaf1a5da Add API to bulk fetch and reset communication channels
Fixes CNVS-24295

Test plan:
 - Create at least three users and give each of them a few email
   addresses
 - Add 'foo@example.com', 'bar@example.com', and 'foobar@example.com'
   as addresses to the first of those three users
 - Run the following, with U1 and U2 replaced with the ids of the
   first and second users you created, respectively (do not
   include the id of the third user in this list):
     CommunicationChannel
       .where(user_id: U1)
       .update_all(bounce_count: 1, last_bounce_at: Time.now)
     CommunicationChannel
       .where(user_id: U2)
       .update_all(bounce_count: 1, last_bounce_at: Time.now - 1.day)
 - As a site admin and on the account's domain, navigate to
   /api/v1/accounts/self/bouncing_communication_channels.csv
 - Ensure that you're given a CSV file that mentions all of the
   first and second user's channels but none of the third user's
   channels
 - Ensure that the second user's channels come before the first
   user's channels, and that the first user's channels mention
   today's date as the last date at which they bounced while
   the second user's channels mention yesterday instead
 - Navigate to /api/v1/accounts/.../bouncing_communication_channels.csv,
   where ... is the id of the account, and verify that you get
   the same result
 - Navigate to
   /api/v1/accounts/self/bouncing_communication_channels.csv?pattern=foo*
 - Ensure that the resulting CSV mentions foo@example.com and
   foobar@example.com but not bar@example.com
 - Navigate to
   /api/v1/accounts/self/bouncing_communication_channels.csv?before=TODAY
   where TODAY is today's date in ISO 8601 format
 - Ensure that the resulting CSV mentions only the second user's
   channels and not the first user's
 - Navigate to
   /api/v1/accounts/self/bouncing_communication_channels.csv?after=TODAY
 - Ensure that the resulting CSV mentions only the first user's
   channels and not the second user's
 - Make a POST request to
   /api/v1/accounts/self/boucing_communication_channels/reset with parameters
   pattern=foo*
 - View the first user's profile
 - Ensure that foo@example.com and foobar@example.com are no longer
   marked as bouncing, but all the other addresses are
 - Make a POST request to
   /api/v1/accounts/self/bouncing_communication_channels/reset with parameters
   before=TODAY where TODAY is today's date in ISO 8601 format
 - View the second user's profile
 - Ensure that all of the second user's communication channels are
   no longer marked as bouncing
 - View the first user's profile
 - Ensure that the user's channels are still marked as bouncing
 - Make a POST request to
   /api/v1/accounts/self/bouncing_communication_channels/reset
 - View the first user's profile
 - Ensure that their channels are now no longer marked as bouncing

Change-Id: Ic937777a03481dc0b442ff6cf766175cc987fd80
Reviewed-on: https://gerrit.instructure.com/68328
Reviewed-by: Alex Boyd <aboyd@instructure.com>
Reviewed-by: Steven Burnett <sburnett@instructure.com>
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: Allison Weiss <allison@instructure.com>
Tested-by: Jenkins
2016-01-11 21:19:42 +00:00
..
migrate Add API to bulk fetch and reset communication channels 2016-01-11 21:19:42 +00:00