def test_should_render_review_request_field(self): """Testing sandboxing ReviewRequestFieldset should_render function in for_review_request_field""" fieldset = [TestShouldRenderFieldset] ReviewRequestFieldSetsHook(extension=self.extension, fieldsets=fieldset) review = ReviewRequest() context = Context({ 'review_request_details': review, 'fieldset': TestShouldRenderFieldset }) t = Template( "{% load reviewtags %}" "{% for_review_request_field review_request_details 'test_should_render' %}" "{% end_for_review_request_field %}") t.render(context).strip()
def test_field_cls_review_request_field(self): """Testing ReviewRequestFieldSetsHook when BaseReviewRequestField.__init__ raises exception """ fieldset = [TestInitFieldset] ReviewRequestFieldSetsHook(extension=self.extension, fieldsets=fieldset) review = ReviewRequest() context = Context({ 'review_request_details': review, 'fieldset': TestInitFieldset }) t = Template( "{% load reviewtags %}" "{% for_review_request_field review_request_details 'test_init' %}" "{% end_for_review_request_field %}") t.render(context).strip()
def test_fieldset_cls_review_request_fieldset(self): """Testing sandboxing ReviewRequestFieldset init function in for_review_request_fieldset""" fieldset = [BaseReviewRequestTestInitFieldset] ReviewRequestFieldSetsHook(extension=self.extension, fieldsets=fieldset) review = ReviewRequest() request = self.factory.get('test') request.user = self.user context = Context({ 'review_request_details': review, 'request': request }) t = Template("{% load reviewtags %}" "{% for_review_request_fieldset review_request_details %}" "{% end_for_review_request_fieldset %}") t.render(context).strip()
def test_is_empty_review_request_fieldset(self): """Testing ReviewRequestFieldSetsHook when BaseReviewRequestField.is_empty raises exception """ fieldset = [BaseReviewRequestTestIsEmptyFieldset] ReviewRequestFieldSetsHook(extension=self.extension, fieldsets=fieldset) review = ReviewRequest() request = self.factory.get('test') request.user = self.user context = Context({ 'review_request_details': review, 'request': request }) t = Template("{% load reviewtags %}" "{% for_review_request_fieldset review_request_details %}" "{% end_for_review_request_fieldset %}") t.render(context).strip()