-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rule Deployment Difference Dialog (#849)
Adds an option to display a full difference in the rules changeset before deployment. Closes #556
- Loading branch information
Showing
6 changed files
with
322 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- Generated with glade 3.38.2 --> | ||
<!-- | ||
Copyright Concurrent Technologies Corporation 2021 | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
--> | ||
<interface> | ||
<requires lib="gtk+" version="3.22"/> | ||
<object class="GtkDialog" id="rulesDifferenceDialog"> | ||
<property name="can-focus">False</property> | ||
<property name="title" translatable="yes">Rule Differences</property> | ||
<property name="modal">True</property> | ||
<property name="window-position">center-on-parent</property> | ||
<property name="default-width">500</property> | ||
<property name="default-height">600</property> | ||
<property name="type-hint">dialog</property> | ||
<child internal-child="vbox"> | ||
<object class="GtkBox"> | ||
<property name="visible">True</property> | ||
<property name="can-focus">False</property> | ||
<property name="orientation">vertical</property> | ||
<property name="spacing">2</property> | ||
<child internal-child="action_area"> | ||
<object class="GtkButtonBox"> | ||
<property name="can-focus">False</property> | ||
<property name="layout-style">end</property> | ||
<child> | ||
<object class="GtkButton" id="okBtn"> | ||
<property name="label">Ok</property> | ||
<property name="visible">True</property> | ||
<property name="can-focus">True</property> | ||
<property name="receives-default">True</property> | ||
<property name="use-stock">True</property> | ||
</object> | ||
<packing> | ||
<property name="expand">True</property> | ||
<property name="fill">True</property> | ||
<property name="position">0</property> | ||
</packing> | ||
</child> | ||
</object> | ||
<packing> | ||
<property name="expand">False</property> | ||
<property name="fill">False</property> | ||
<property name="position">0</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkBox"> | ||
<property name="visible">True</property> | ||
<property name="can-focus">False</property> | ||
<property name="spacing">2</property> | ||
<child> | ||
<object class="GtkBox"> | ||
<property name="visible">True</property> | ||
<property name="can-focus">False</property> | ||
<property name="orientation">vertical</property> | ||
<child> | ||
<object class="GtkLabel"> | ||
<property name="visible">True</property> | ||
<property name="can-focus">False</property> | ||
<property name="label" translatable="yes">Previous Rules</property> | ||
</object> | ||
<packing> | ||
<property name="expand">False</property> | ||
<property name="fill">True</property> | ||
<property name="position">0</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkScrolledWindow" id="prevContent"> | ||
<property name="visible">True</property> | ||
<property name="can-focus">True</property> | ||
<property name="shadow-type">in</property> | ||
<child> | ||
<placeholder/> | ||
</child> | ||
</object> | ||
<packing> | ||
<property name="expand">True</property> | ||
<property name="fill">True</property> | ||
<property name="position">1</property> | ||
</packing> | ||
</child> | ||
</object> | ||
<packing> | ||
<property name="expand">True</property> | ||
<property name="fill">True</property> | ||
<property name="position">0</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkBox"> | ||
<property name="visible">True</property> | ||
<property name="can-focus">False</property> | ||
<property name="orientation">vertical</property> | ||
<child> | ||
<object class="GtkLabel"> | ||
<property name="visible">True</property> | ||
<property name="can-focus">False</property> | ||
<property name="label" translatable="yes">New Rules</property> | ||
</object> | ||
<packing> | ||
<property name="expand">False</property> | ||
<property name="fill">True</property> | ||
<property name="position">0</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkScrolledWindow" id="newContent"> | ||
<property name="visible">True</property> | ||
<property name="can-focus">True</property> | ||
<property name="shadow-type">in</property> | ||
<child> | ||
<placeholder/> | ||
</child> | ||
</object> | ||
<packing> | ||
<property name="expand">True</property> | ||
<property name="fill">True</property> | ||
<property name="position">1</property> | ||
</packing> | ||
</child> | ||
</object> | ||
<packing> | ||
<property name="expand">True</property> | ||
<property name="fill">True</property> | ||
<property name="position">1</property> | ||
</packing> | ||
</child> | ||
</object> | ||
<packing> | ||
<property name="expand">True</property> | ||
<property name="fill">True</property> | ||
<property name="position">1</property> | ||
</packing> | ||
</child> | ||
</object> | ||
</child> | ||
<action-widgets> | ||
<action-widget response="1">okBtn</action-widget> | ||
</action-widgets> | ||
</object> | ||
</interface> |
30 changes: 30 additions & 0 deletions
30
fapolicy_analyzer/tests/rules/test_rules_difference_dialog.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Copyright Concurrent Technologies Corporation 2023 | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
import gi | ||
from fapolicy_analyzer.ui.rules.rules_difference_dialog import RulesDifferenceDialog | ||
from unittest.mock import MagicMock | ||
|
||
gi.require_version("GtkSource", "3.0") | ||
from gi.repository import Gtk # isort: skip | ||
|
||
|
||
def test_creates_widget(mocker): | ||
mocker.patch( | ||
"fapolicy_analyzer.ui.rules.rules_difference_dialog.rules_difference", | ||
return_value="", | ||
) | ||
widget = RulesDifferenceDialog(MagicMock(), MagicMock(), parent=Gtk.Window()) | ||
assert type(widget) is RulesDifferenceDialog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.