|
@@ 455-476 (lines=22) @@
|
| 452 |
|
assert password_proxy_mock.RootPassword == "aaaa" |
| 453 |
|
|
| 454 |
|
|
| 455 |
|
def test_evaluation_passwd_minlen_short_passwd_report_only( |
| 456 |
|
proxy_getter, rule_data, ksdata_mock, storage_mock): |
| 457 |
|
password_proxy_mock = USERS.get_proxy() |
| 458 |
|
password_proxy_mock.IsRootPasswordCrypted = False |
| 459 |
|
password_proxy_mock.RootPassword = "aaaa" |
| 460 |
|
|
| 461 |
|
rule_data.new_rule("passwd --minlen=8") |
| 462 |
|
|
| 463 |
|
messages = rule_data.eval_rules(ksdata_mock, storage_mock, report_only=True) |
| 464 |
|
|
| 465 |
|
# minimal password length greater than actual length --> one warning |
| 466 |
|
assert len(messages) == 1 |
| 467 |
|
assert messages[0].type == common.MESSAGE_TYPE_FATAL |
| 468 |
|
|
| 469 |
|
# warning has to mention the length |
| 470 |
|
assert "8" in messages[0].text |
| 471 |
|
|
| 472 |
|
# warning should mention that something is wrong with the old password |
| 473 |
|
assert "is" in messages[0].text |
| 474 |
|
|
| 475 |
|
# doing changes --> password should not be cleared |
| 476 |
|
assert password_proxy_mock.RootPassword == "aaaa" |
| 477 |
|
|
| 478 |
|
|
| 479 |
|
def test_evaluation_passwd_minlen_crypted_passwd( |
|
@@ 431-452 (lines=22) @@
|
| 428 |
|
assert str(not_wanted) not in messages[0].text |
| 429 |
|
|
| 430 |
|
|
| 431 |
|
def test_evaluation_passwd_minlen_short_passwd( |
| 432 |
|
proxy_getter, rule_data, ksdata_mock, storage_mock): |
| 433 |
|
password_proxy_mock = USERS.get_proxy() |
| 434 |
|
password_proxy_mock.IsRootPasswordCrypted = False |
| 435 |
|
password_proxy_mock.RootPassword = "aaaa" |
| 436 |
|
|
| 437 |
|
rule_data.new_rule("passwd --minlen=8") |
| 438 |
|
|
| 439 |
|
messages = rule_data.eval_rules(ksdata_mock, storage_mock, report_only=False) |
| 440 |
|
|
| 441 |
|
# minimal password length greater than actual length --> one warning |
| 442 |
|
assert len(messages) == 1 |
| 443 |
|
assert messages[0].type == common.MESSAGE_TYPE_FATAL |
| 444 |
|
|
| 445 |
|
# warning has to mention the length |
| 446 |
|
assert "8" in messages[0].text |
| 447 |
|
|
| 448 |
|
# warning should mention that something is wrong with the old password |
| 449 |
|
assert "is" in messages[0].text |
| 450 |
|
|
| 451 |
|
# doing changes --> password should not be cleared |
| 452 |
|
assert password_proxy_mock.RootPassword == "aaaa" |
| 453 |
|
|
| 454 |
|
|
| 455 |
|
def test_evaluation_passwd_minlen_short_passwd_report_only( |