def test_path_and_object_missing(self): """ Checks if TypeError is raised when both path and object params are missing. """ with pytest.raises(TypeError): build_absolute_url({}, object=None, path=None)
def test_build_absolute_url_called(self, m): """ Checks if build_absolute_url() is called correctly by {% build_absolute_url %} tag. """ m.return_value = 'http://example.com/test/' s = Site(domain='spam', name='spam') context = {'site': s} ret = build_absolute_url(context, path='/test/', foo='bar') m.assert_called_once_with( path='/test/', object=None, site=s, builder=None, foo='bar', context=context, request=None) assert ret == m.return_value
def test_build_absolute_url_called(self, m): """ Checks if build_absolute_url() is called correctly by {% build_absolute_url %} tag. """ m.return_value = 'http://example.com/test/' s = Site(domain='spam', name='spam') context = {'site': s} ret = build_absolute_url(context, path='/test/', foo='bar') m.assert_called_once_with(path='/test/', object=None, site=s, builder=None, foo='bar', context=context, request=None) assert ret == m.return_value