'Verify the addition of new resource is handled correctly'

def test_add_resource(self):

    self.enroll_student(self.STUDENTS[0]['email'], self.STUDENTS[0]['password'])
    for (resource_id, resource) in self.test_recommendations.iteritems():
        for xblock_name in self.XBLOCK_NAMES:
            result = self.call_event('add_resource', resource, xblock_name)
            expected_result = {'upvotes': 0, 'downvotes': 0, 'id': resource_id}
            for field in resource:
                expected_result[field] = resource[field]
            self.assertDictEqual(json.loads(result.content), expected_result)
            self.assert_request_status_code(200, self.course_url)
