Commit graph

4 commits

Author SHA1 Message Date
Christian Boltz
f6dcade84f Change abstract methods in BaseRule to use NotImplementedError
As Kshitij mentioned, abstract methods should use NotImplementedError
instead of AppArmorBug.

While changing this, I noticed that __repr__() needs to be robust against
NotImplementedError because get_raw() is not available in BaseRule.
Therefore the patch changes __repr__() to catch NotImplementedError.

Of course the change to NotImplementedError also needs several
adjustments in the tests.


Acked-by: Kshitij Gupta <kgupta8592@gmail.com>
(long before branching off 2.10, therefore I also commit to 2.10)


Note: 2.10 doesn't have test-signal.py, which means it can't be patched ;-)
2015-11-24 00:22:37 +01:00
Christian Boltz
e59cf31a7b Update RlimitRule to match the parser changes
- allow only a specific set of time units
- optionally allow whitespace between rlimit value and unit
- move check for invalid time units to time_to_int()

Also update the tests:
- add several tests with whitespace between value and unit
- change a test that used the (now invalid) "1m" to "1min"
- change the time_to_int() tests to use 'us' as default unit, and add
  a test with 'seconds' as default unit


Acked-by: Steve Beattie <steve@nxnw.org>
2015-07-11 14:05:32 +02:00
Christian Boltz
418241473b Fix rttime default unit in RlimitRule
RlimitRule accidently used 'ms' (milliseconds) as default unit for
rttime rules, but rttime without unit means 'us' (microseconds). This
patch fixes this.

Also add some tests with 'us' as unit, and two more to cover terribly
invalid corner cases (and to improve test coverage by 2 lines ;-)


Acked-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2015-06-27 21:52:09 +02:00
Christian Boltz
ee10eacff8 Add tests for RlimitRule and RlimitRuleset
This time we only have 98% coverage (some missing and partial) because
I didn't find corner cases that raise some exceptions ;-)


Acked-by: Steve Beattie <steve@nxnw.org>
2015-06-06 14:39:33 +02:00