trustpoint.tests.test_views.test_context_data

Tests for the ContextDataMixin class.

Classes

MockView

Mock view for testing ContextDataMixin.

ContextDataMixinTestMixin

ContextDataMixinTests

Test cases for ContextDataMixin.

Module Contents

class trustpoint.tests.test_views.test_context_data.MockView(**kwargs)[source]

Bases: trustpoint.views.base.ContextDataMixin, django.views.generic.TemplateView

Mock view for testing ContextDataMixin.

template_name = 'example_template.html'[source]
context_page_category = 'test_category'[source]
context_page_name = 'test_name'[source]
context_custom_field = 'custom_value'[source]
class trustpoint.tests.test_views.test_context_data.ContextDataMixinTestMixin[source]
get_context_data(**kwargs)[source]

Override get_context_data to simulate ContextDataMixin behavior.

Parameters:

kwargs (Any)

Return type:

dict[str, Any]

class trustpoint.tests.test_views.test_context_data.ContextDataMixinTests(methodName='runTest')[source]

Bases: django.test.TestCase

Test cases for ContextDataMixin.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

Return type:

None

test_context_attributes_added()[source]

Test that ‘context_’ prefixed attributes are added to the context data.

test_no_unprefixed_attributes_added()[source]

Test that attributes without ‘context_’ prefix are not added to the context data.

test_overridden_context_does_not_change()[source]

Test that existing context keys are not overridden by ‘context_’ prefixed attributes.

test_context_data_with_additional_kwargs()[source]

Test that additional kwargs passed to get_context_data are included in the context.