'Test attempts to edit the "abuse_flagged" field.
old_flagged indicates whether the comment should be flagged at the start
of the test. new_flagged indicates the value for the "abuse_flagged"
field in the update. If old_flagged and new_flagged are the same, no
update should be made. Otherwise, a PUT should be made to the flag or
or unflag endpoint according to the new_flagged value.'

@ddt.data(*itertools.product([True, False], [True, False]))
@ddt.unpack
def test_abuse_flagged(self, old_flagged, new_flagged):

    self.register_get_user_response(self.user)
    self.register_comment_flag_response('test_comment')
    self.register_comment({'abuse_flaggers': ([str(self.user.id)] if old_flagged else [])})
    data = {'abuse_flagged': new_flagged}
    result = update_comment(self.request, 'test_comment', data)
    self.assertEqual(result['abuse_flagged'], new_flagged)
    last_request_path = urlparse(httpretty.last_request().path).path
    flag_url = '/api/v1/comments/test_comment/abuse_flag'
    unflag_url = '/api/v1/comments/test_comment/abuse_unflag'
    if (old_flagged == new_flagged):
        self.assertNotEqual(last_request_path, flag_url)
        self.assertNotEqual(last_request_path, unflag_url)
    else:
        self.assertEqual(last_request_path, (flag_url if new_flagged else unflag_url))
        self.assertEqual(httpretty.last_request().method, 'PUT')
        self.assertEqual(httpretty.last_request().parsed_body, {'user_id': [str(self.user.id)]})
