'Test getting, setting, and defaulting the locked attr and arbitrary attrs.'

def test_contentstore_attrs(self):

    location = Location('edX', 'toy', '2012_Fall', 'course', '2012_Fall')
    (course_content, __) = self.content_store.get_all_content_for_course(location.course_key)
    assert_true((len(course_content) > 0))
    filter_params = _build_requested_filter('Images')
    (filtered_course_content, __) = self.content_store.get_all_content_for_course(location.course_key, filter_params=filter_params)
    assert_true((len(filtered_course_content) < len(course_content)))
    for content in course_content:
        assert (not content.get('locked', False))
        asset_key = AssetLocation._from_deprecated_son(content.get('content_son', content['_id']), location.run)
        assert (not self.content_store.get_attr(asset_key, 'locked', False))
        attrs = self.content_store.get_attrs(asset_key)
        assert_in('uploadDate', attrs)
        assert (not attrs.get('locked', False))
        self.content_store.set_attr(asset_key, 'locked', True)
        assert self.content_store.get_attr(asset_key, 'locked', False)
        attrs = self.content_store.get_attrs(asset_key)
        assert_in('locked', attrs)
        assert (attrs['locked'] is True)
        self.content_store.set_attrs(asset_key, {'miscel': 99})
        assert_equals(self.content_store.get_attr(asset_key, 'miscel'), 99)
    asset_key = AssetLocation._from_deprecated_son(course_content[0].get('content_son', course_content[0]['_id']), location.run)
    assert_raises(AttributeError, self.content_store.set_attr, asset_key, 'md5', 'ff1532598830e3feac91c2449eaa60d6')
    assert_raises(AttributeError, self.content_store.set_attrs, asset_key, {'foo': 9, 'md5': 'ff1532598830e3feac91c2449eaa60d6'})
    assert_raises(NotFoundError, self.content_store.get_attr, Location('bogus', 'bogus', 'bogus', 'asset', 'bogus'), 'displayname')
    assert_raises(NotFoundError, self.content_store.set_attr, Location('bogus', 'bogus', 'bogus', 'asset', 'bogus'), 'displayname', 'hello')
    assert_raises(NotFoundError, self.content_store.get_attrs, Location('bogus', 'bogus', 'bogus', 'asset', 'bogus'))
    assert_raises(NotFoundError, self.content_store.set_attrs, Location('bogus', 'bogus', 'bogus', 'asset', 'bogus'), {'displayname': 'hello'})
    assert_raises(NotFoundError, self.content_store.set_attrs, Location('bogus', 'bogus', 'bogus', 'asset', None), {'displayname': 'hello'})
