Skip to content

Commit

Permalink
Tests - Skip some checks when on CI testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustry committed Oct 25, 2023
1 parent cc6f658 commit 0066030
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
6 changes: 4 additions & 2 deletions lizmap/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2798,7 +2798,9 @@ def write_project_config_file(self, lwc_version: LwcVersions, with_gui: bool = T
self.clean_project()
return True

def project_config_file(self, lwc_version: LwcVersions, with_gui: bool = True, check_server=True) -> Optional[Dict]:
def project_config_file(
self, lwc_version: LwcVersions, with_gui: bool = True, check_server=True, ignore_error=False
) -> Optional[Dict]:
""" Generate the CFG file with all options. """
valid, _ = self.check_project_validity()

Expand Down Expand Up @@ -3030,7 +3032,7 @@ def project_config_file(self, lwc_version: LwcVersions, with_gui: bool = True, c
self.dlg.out_log.moveCursor(QTextCursor.Start)
self.dlg.out_log.ensureCursorVisible()

if with_gui and error_cfg_saving:
if with_gui and error_cfg_saving and not ignore_error:
self.dlg.log_panel.append(tr('Issues which can be fixed automatically'), Html.H2)
self.dlg.log_panel.append(tr(
'You have issue(s) listed above, and there is a wizard to auto fix your project. Saving the'
Expand Down
14 changes: 7 additions & 7 deletions lizmap/test/test_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def test_legend_options(self):
lizmap.myDic.get('legend_hidden_startup_layer_id').get('legend_image_option'))

# For LWC 3.6
output = lizmap.project_config_file(LwcVersions.Lizmap_3_6, check_server=False)
output = lizmap.project_config_file(LwcVersions.Lizmap_3_6, check_server=False, ignore_error=True)
self.assertEqual(output['layers']['legend_displayed_startup']['legend_image_option'], 'expand_at_startup')
self.assertIsNone(output['layers']['legend_displayed_startup'].get('noLegendImage'))

Expand Down Expand Up @@ -158,7 +158,7 @@ def test_lizmap_layer_properties(self):
self.assertTrue(lizmap.dlg.list_group_visibility.isEnabled())

# Check new values in the output config
output = lizmap.project_config_file(LwcVersions.latest(), check_server=False)
output = lizmap.project_config_file(LwcVersions.latest(), check_server=False, ignore_error=True)
# Layers
self.assertListEqual(output['layers']['lines']['group_visibility'], [acl_layer])
self.assertEqual(output['layers']['lines']['abstract'], html_abstract)
Expand Down Expand Up @@ -200,7 +200,7 @@ def test_general_scales_properties(self):
self.assertEqual(scales, lizmap.dlg.inMapScales.text())

# Check new values in the output config
output = lizmap.project_config_file(LwcVersions.latest(), check_server=False)
output = lizmap.project_config_file(LwcVersions.latest(), check_server=False, ignore_error=True)

# Check scales in the CFG
self.assertEqual(1000, output['options']['minScale'])
Expand All @@ -210,24 +210,24 @@ def test_general_scales_properties(self):
# Check an empty list and a populated list then
self.assertIsNone(output['options'].get('acl'))
lizmap.dlg.inAcl.setText('cadastre,urbanism')
output = lizmap.project_config_file(LwcVersions.latest(), check_server=False)
output = lizmap.project_config_file(LwcVersions.latest(), check_server=False, ignore_error=True)
self.assertListEqual(['cadastre', 'urbanism'], output['options'].get('acl'))

def test_general_properties_true_values(self):
""" Test some UI settings about boolean values. """
lizmap = self._setup_empty_project()

output = lizmap.project_config_file(LwcVersions.latest(), check_server=False)
output = lizmap.project_config_file(LwcVersions.latest(), check_server=False, ignore_error=True)
self.assertIsNone(output['options'].get('atlasAutoPlay'))

lizmap.dlg.atlasAutoPlay.setChecked(True)

output = lizmap.project_config_file(LwcVersions.latest(), check_server=False)
output = lizmap.project_config_file(LwcVersions.latest(), check_server=False, ignore_error=True)
self.assertTrue(output['options'].get('atlasAutoPlay'))

lizmap.dlg.atlasAutoPlay.setChecked(False)

output = lizmap.project_config_file(LwcVersions.latest(), check_server=False)
output = lizmap.project_config_file(LwcVersions.latest(), check_server=False, ignore_error=True)
self.assertIsNone(output['options'].get('atlasAutoPlay'))

# Test some strings as well as default value
Expand Down

0 comments on commit 0066030

Please sign in to comment.