On Tue, May 06, 2014 at 07:35:57PM +0400, Ivan Kluchnikov wrote:
hi,
+ if ((int)gsm_auth_policy_parse(value) < 0) {
+ return -1;
+ }
1.) Coding-Style.
2.) The (int) cast is fishy. Most likely even undefined C usage. We have
a int(-EINVAL) -> enum -> int conversion here. Add an invalid element to
the enum, change the implementation to compare to -EINVAL...
Then your verify call becomes a simple one liner and comparison against
the invalid element.
+ def testAuthPolicy(self):
+ r = self.do_set('auth-policy', 'qwerty')
+ self.assertEquals(r['mtype'], 'ERROR')
+ self.assertEquals(r['error'], 'Value failed verification.')
Check that the previous thing has not been changed. :)