'Test attempts to edit the "following" field.
old_following indicates whether the thread should be followed at the
start of the test. new_following indicates the value for the "following"
field in the update. If old_following and new_following are the same, no
update should be made. Otherwise, a subscription should be POSTed or
DELETEd according to the new_following value.'

@ddt.data(*itertools.product([True, False], [True, False]))
@ddt.unpack
def test_following(self, old_following, new_following):

    if old_following:
        self.register_get_user_response(self.user, subscribed_thread_ids=['test_thread'])
    self.register_subscription_response(self.user)
    self.register_thread()
    data = {'following': new_following}
    result = update_thread(self.request, 'test_thread', data)
    self.assertEqual(result['following'], new_following)
    last_request_path = urlparse(httpretty.last_request().path).path
    subscription_url = '/api/v1/users/{}/subscriptions'.format(self.user.id)
    if (old_following == new_following):
        self.assertNotEqual(last_request_path, subscription_url)
    else:
        self.assertEqual(last_request_path, subscription_url)
        self.assertEqual(httpretty.last_request().method, ('POST' if new_following else 'DELETE'))
        request_data = (httpretty.last_request().parsed_body if new_following else parse_qs(urlparse(httpretty.last_request().path).query))
        request_data.pop('request_id', None)
        self.assertEqual(request_data, {'source_type': ['thread'], 'source_id': ['test_thread']})
