def test_og_no_document(self, render_app_html): render_app_html.return_value = "<html></html>" annotation = {"id": "123", "user": "******"} context = mock.MagicMock(model=annotation) request = _dummy_request() views.annotation(context, request) args, kwargs = render_app_html.call_args test = lambda d: "foo" in d["content"] assert any(test(d) for d in kwargs["extra"]["meta_attrs"])
def test_og_no_document(self): context = {'id': '123', 'user': '******'} request = testing.DummyRequest() result = views.annotation(context, request) assert isinstance(result, dict) test = lambda d: 'foo' in d['content'] assert any(test(d) for d in result['meta_attrs'])
def test_og_document(self): context = {'id': '123', 'user': '******'} context['document'] = {'title': 'WikiHow — How to Make a ☆Starmap☆'} request = testing.DummyRequest() result = views.annotation(context, request) assert isinstance(result, dict) test = lambda d: 'foo' in d['content'] and 'Starmap' in d['content'] assert any(test(d) for d in result['meta_attrs'])