File: test_polcap.py

package info (click to toggle)
setools 4.6.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,600 kB
  • sloc: python: 24,485; makefile: 14
file content (21 lines) | stat: -rw-r--r-- 622 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Copyright 2015, Tresys Technology, LLC
#
# SPDX-License-Identifier: GPL-2.0-only
#
import pytest


@pytest.mark.obj_args("tests/library/policyrep/polcap.conf")
class TestPolicyCapability:

    def test_string(self, compiled_policy):
        """PolCap: basic string rendering."""
        caps = list(compiled_policy.polcaps())
        assert len(caps) == 1
        assert "open_perms" == str(caps[0])

    def test_statement(self, compiled_policy):
        """PolCap: statement."""
        caps = list(compiled_policy.polcaps())
        assert len(caps) == 1
        assert "policycap open_perms;" == caps[0].statement()