[tracker/wip/carlosg/more-tests: 11/12] tests: Add functional test for tracker-xdg-portal-3
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/more-tests: 11/12] tests: Add functional test for tracker-xdg-portal-3
- Date: Tue, 29 Sep 2020 13:56:30 +0000 (UTC)
commit 5985b16705ca6af4b631fc3aafa1d079120e3d5b
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Sep 29 15:08:07 2020 +0200
tests: Add functional test for tracker-xdg-portal-3
Add an specific test for portal things, at the moment some minimal tests
about allowed/disallowed services and graphs is done.
tests/flatpak-info | 1 +
tests/functional-tests/meson.build | 1 +
tests/functional-tests/portal.py | 62 ++++++++++++++++++++++++++++++++++++++
3 files changed, 64 insertions(+)
---
diff --git a/tests/flatpak-info b/tests/flatpak-info
index 4af14d3f4..943933657 100644
--- a/tests/flatpak-info
+++ b/tests/flatpak-info
@@ -1 +1,2 @@
[Policy Tracker3]
+dbus:org.freedesktop.PortalTest=tracker:Allowed
diff --git a/tests/functional-tests/meson.build b/tests/functional-tests/meson.build
index b9efebb6c..4cdc911a7 100644
--- a/tests/functional-tests/meson.build
+++ b/tests/functional-tests/meson.build
@@ -30,6 +30,7 @@ functional_tests = [
'collation',
'ontology-changes',
'cli',
+ 'portal',
]
test_env = environment()
diff --git a/tests/functional-tests/portal.py b/tests/functional-tests/portal.py
new file mode 100644
index 000000000..a4e82820f
--- /dev/null
+++ b/tests/functional-tests/portal.py
@@ -0,0 +1,62 @@
+# Copyright (C) 2020, Carlos Garnacho <carlosg gnome org>
+#
+# 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 2
+# 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, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+
+"""
+Test portal
+"""
+
+from gi.repository import GLib
+
+import unittest
+
+import configuration
+import fixtures
+
+class TestPortal(fixtures.TrackerPortalTest):
+ def test_01_forbidden(self):
+ self.start_service('org.freedesktop.Inaccessible')
+ self.assertRaises(
+ GLib.Error, self.query,
+ 'org.freedesktop.Inaccessible',
+ 'select ?u { BIND (1 AS ?u) }')
+
+ def test_02_allowed(self):
+ self.start_service('org.freedesktop.PortalTest')
+ res = self.query(
+ 'org.freedesktop.PortalTest',
+ 'select ?u { BIND (1 AS ?u) }')
+ self.assertEqual(len(res), 1)
+ self.assertEqual(res[0][0], '1')
+
+ def test_03_graph_access(self):
+ self.start_service('org.freedesktop.PortalTest')
+ self.update(
+ 'org.freedesktop.PortalTest',
+ 'CREATE GRAPH tracker:Disallowed;' +
+ 'INSERT { GRAPH tracker:Disallowed { <a> a nfo:FileDataObject } };' +
+ 'CREATE GRAPH tracker:Allowed;' +
+ 'INSERT { GRAPH tracker:Allowed { <b> a nfo:FileDataObject } }')
+ res = self.query(
+ 'org.freedesktop.PortalTest',
+ 'select ?u { ?u a rdfs:Resource }')
+ self.assertEqual(len(res), 1)
+ self.assertEqual(res[0][0], 'b')
+
+
+if __name__ == '__main__':
+ fixtures.tracker_test_main()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]