'Make sure of proper filtering when using bulk operations and
calling get_courses with an \'org\' filter'

def test_bulk_ops_org_filtering(self):

    user = random.getrandbits(32)
    course_key = CourseLocator('test_org', 'test_transaction', 'test_run')
    with modulestore().bulk_operations(course_key):
        modulestore().create_course('test_org', 'test_transaction', 'test_run', user, BRANCH_NAME_DRAFT)
        courses = modulestore().get_courses(branch=BRANCH_NAME_DRAFT, org='test_org')
        self.assertEqual(len(courses), 1)
        self.assertEqual(courses[0].id.org, course_key.org)
        self.assertEqual(courses[0].id.course, course_key.course)
        self.assertEqual(courses[0].id.run, course_key.run)
        courses = modulestore().get_courses(branch=BRANCH_NAME_DRAFT, org='other_org')
        self.assertEqual(len(courses), 0)
    courses = modulestore().get_courses(branch=BRANCH_NAME_DRAFT, org='test_org')
    self.assertEqual(len(courses), 1)
    self.assertEqual(courses[0].id.org, course_key.org)
    self.assertEqual(courses[0].id.course, course_key.course)
    self.assertEqual(courses[0].id.run, course_key.run)
    courses = modulestore().get_courses(branch=BRANCH_NAME_DRAFT, org='other_org')
    self.assertEqual(len(courses), 0)
