@@ -44,6 +44,25 @@ class TestRssPluginIntegrationsMaterialSocialCards(BaseTest):
4444 """Test integration of Social Cards plugin with RSS plugin."""
4545
4646 # -- TESTS ---------------------------------------------------------
47+ def test_plugin_config_social_cards_enabled_but_integration_disabled (self ):
48+ # default reference
49+ cfg_mkdocs = load_config (
50+ str (
51+ Path (
52+ "tests/fixtures/mkdocs_item_image_social_cards_enabled_but_integration_disabled.yml"
53+ ).resolve ()
54+ )
55+ )
56+
57+ integration_social_cards = IntegrationMaterialSocialCards (
58+ mkdocs_config = cfg_mkdocs ,
59+ switch_force = cfg_mkdocs .plugins .get ("rss" ).config .use_material_social_cards ,
60+ )
61+ self .assertTrue (integration_social_cards .IS_THEME_MATERIAL )
62+ self .assertTrue (integration_social_cards .IS_SOCIAL_PLUGIN_ENABLED )
63+ self .assertTrue (integration_social_cards .IS_SOCIAL_PLUGIN_CARDS_ENABLED )
64+ self .assertFalse (integration_social_cards .IS_ENABLED )
65+
4766 def test_plugin_config_social_cards_enabled (self ):
4867 # default reference
4968 cfg_mkdocs = load_config (
@@ -62,6 +81,24 @@ def test_plugin_config_social_cards_enabled(self):
6281 self .assertTrue (integration_social_cards .IS_SOCIAL_PLUGIN_CARDS_ENABLED )
6382 self .assertTrue (integration_social_cards .IS_ENABLED )
6483
84+ def test_plugin_config_social_cards_disabled (self ):
85+ # default reference
86+ cfg_mkdocs = load_config (
87+ str (
88+ Path (
89+ "tests/fixtures/mkdocs_item_image_social_cards_disabled_site.yml"
90+ ).resolve ()
91+ )
92+ )
93+
94+ integration_social_cards = IntegrationMaterialSocialCards (
95+ mkdocs_config = cfg_mkdocs
96+ )
97+ self .assertTrue (integration_social_cards .IS_THEME_MATERIAL )
98+ self .assertFalse (integration_social_cards .IS_SOCIAL_PLUGIN_ENABLED )
99+ self .assertFalse (integration_social_cards .IS_SOCIAL_PLUGIN_CARDS_ENABLED )
100+ self .assertFalse (integration_social_cards .IS_ENABLED )
101+
65102 def test_plugin_config_social_plugin_enabled_but_cards_disabled (self ):
66103 # default reference
67104 cfg_mkdocs = load_config (
@@ -106,6 +143,31 @@ def test_simple_build(self):
106143 feed_parsed = feedparser .parse (Path (tmpdirname ) / "feed_rss_updated.xml" )
107144 self .assertEqual (feed_parsed .bozo , 0 )
108145
146+ with tempfile .TemporaryDirectory () as tmpdirname :
147+ cli_result = self .build_docs_setup (
148+ testproject_path = "docs" ,
149+ mkdocs_yml_filepath = Path (
150+ "tests/fixtures/mkdocs_item_image_social_cards_disabled_site.yml"
151+ ),
152+ output_path = tmpdirname ,
153+ strict = False ,
154+ )
155+
156+ if cli_result .exception is not None :
157+ e = cli_result .exception
158+ logger .debug (format_exception (type (e ), e , e .__traceback__ ))
159+
160+ self .assertEqual (cli_result .exit_code , 0 )
161+ self .assertIsNone (cli_result .exception )
162+
163+ # created items
164+ feed_parsed = feedparser .parse (Path (tmpdirname ) / "feed_rss_created.xml" )
165+ self .assertEqual (feed_parsed .bozo , 0 )
166+
167+ # updated items
168+ feed_parsed = feedparser .parse (Path (tmpdirname ) / "feed_rss_updated.xml" )
169+ self .assertEqual (feed_parsed .bozo , 0 )
170+
109171
110172# ##############################################################################
111173# ##### Stand alone program ########
0 commit comments