Skip to content

Instantly share code, notes, and snippets.

@piotr-dobrogost
Created October 2, 2015 09:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save piotr-dobrogost/34f6df8c35aecdaa23c9 to your computer and use it in GitHub Desktop.
Save piotr-dobrogost/34f6df8c35aecdaa23c9 to your computer and use it in GitHub Desktop.
Traceback (most recent call last):
File "/home/piotr/projects/kotti_content_proxy/kotti_content_proxy/tests/conftest.py", line 12, in foo_proxy
from kotti_content_proxy.resources import ContentProxy
File "/home/piotr/projects/kotti_content_proxy/kotti_content_proxy/__init__.py", line 10, in <module>
from .resources import ContentProxy
File "/home/piotr/projects/kotti_content_proxy/kotti_content_proxy/resources.py", line 14, in <module>
from kotti_content_proxy import _
ImportError: cannot import name _
import pytest
def test_proxying_custom_attributes(foo_proxy):
import kotti_content_proxy
settings = {
'kotti_content_proxy.proxied_attrs': ['some_attribute',
'another_attribute']
}
kotti_content_proxy.kotti_configure(settings)
foo = foo_proxy['foo']
proxy = foo_proxy['proxy']
assert proxy.some_attribute == foo.some_attribute
with pytest.raises(AttributeError) as excinfo:
proxy.another_attribute
assert excinfo.value.message == "'Document' object has no attribute 'another_attribute'" # noqa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment