pybind: fix tests that do not fail as expected

A missing argument make the test fail indeed, but the intended test is
to demonstrate something else ( either character validation or excess of
arguments etc. ). The result is {} instead of None which is what should
have been expected in the first place.

Ideally there would be a more verbose way to check for syntactic errors
to make such mistakes less probable.

Reviewed-By: Christophe Courtaut <christophe.courtaut@gmail.com>
Signed-off-by: Loic Dachary <loic@dachary.org>
This commit is contained in:
Loic Dachary 2014-01-29 14:52:22 +01:00
parent cb39b13676
commit ad09023e1b

View File

@ -695,37 +695,38 @@ class TestOSD(TestArgparse):
tunable]) tunable])
assert_equal({}, validate_command(sigdict, ['osd', 'crush', assert_equal({}, validate_command(sigdict, ['osd', 'crush',
'tunables'])) 'tunables']))
assert_equal(None, validate_command(sigdict, ['osd', 'crush', assert_equal({}, validate_command(sigdict, ['osd', 'crush',
'tunables',
'default', 'toomany'])) 'default', 'toomany']))
def test_crush_rule_create_simple(self): def test_crush_rule_create_simple(self):
self.assert_valid_command(['osd', 'crush', 'rule', 'create-simple', self.assert_valid_command(['osd', 'crush', 'rule', 'create-simple',
'AZaz09-_.', 'AZaz09-_.', 'AZaz09-_.']) 'AZaz09-_.', 'AZaz09-_.', 'AZaz09-_.'])
assert_equal(None, validate_command(sigdict, ['osd', 'crush', assert_equal({}, validate_command(sigdict, ['osd', 'crush', 'rule',
'create-simple'])) 'create-simple']))
assert_equal(None, validate_command(sigdict, ['osd', 'crush', assert_equal({}, validate_command(sigdict, ['osd', 'crush', 'rule',
'create-simple', 'create-simple',
'AZaz09-_.'])) 'AZaz09-_.']))
assert_equal(None, validate_command(sigdict, ['osd', 'crush', assert_equal({}, validate_command(sigdict, ['osd', 'crush', 'rule',
'create-simple', 'create-simple',
'AZaz09-_.', 'AZaz09-_.',
'AZaz09-_.'])) 'AZaz09-_.']))
assert_equal(None, validate_command(sigdict, ['osd', 'crush', assert_equal({}, validate_command(sigdict, ['osd', 'crush', 'rule',
'create-simple', 'create-simple',
'!!!', '!!!',
'AZaz09-_.', 'AZaz09-_.',
'AZaz09-_.'])) 'AZaz09-_.']))
assert_equal(None, validate_command(sigdict, ['osd', 'crush', assert_equal({}, validate_command(sigdict, ['osd', 'crush', 'rule',
'create-simple', 'create-simple',
'AZaz09-_.', 'AZaz09-_.',
'|||', '|||',
'AZaz09-_.'])) 'AZaz09-_.']))
assert_equal(None, validate_command(sigdict, ['osd', 'crush', assert_equal({}, validate_command(sigdict, ['osd', 'crush', 'rule',
'create-simple', 'create-simple',
'AZaz09-_.', 'AZaz09-_.',
'AZaz09-_.', 'AZaz09-_.',
'+++'])) '+++']))
assert_equal(None, validate_command(sigdict, ['osd', 'crush', assert_equal({}, validate_command(sigdict, ['osd', 'crush', 'rule',
'create-simple', 'create-simple',
'AZaz09-_.', 'AZaz09-_.',
'AZaz09-_.', 'AZaz09-_.',