|
@@ 486-507 (lines=22) @@
|
| 483 |
|
assert password_proxy_mock.RootPassword == "aaaa" |
| 484 |
|
|
| 485 |
|
|
| 486 |
|
def test_evaluation_passwd_minlen_short_passwd_report_only( |
| 487 |
|
proxy_getter, rule_data, ksdata_mock, storage_mock): |
| 488 |
|
password_proxy_mock = USERS.get_proxy() |
| 489 |
|
password_proxy_mock.IsRootPasswordCrypted = False |
| 490 |
|
password_proxy_mock.RootPassword = "aaaa" |
| 491 |
|
|
| 492 |
|
rule_data.new_rule("passwd --minlen=8") |
| 493 |
|
|
| 494 |
|
messages = rule_data.eval_rules(ksdata_mock, storage_mock, report_only=True) |
| 495 |
|
|
| 496 |
|
# minimal password length greater than actual length --> one warning |
| 497 |
|
assert len(messages) == 1 |
| 498 |
|
assert messages[0].type == common.MESSAGE_TYPE_FATAL |
| 499 |
|
|
| 500 |
|
# warning has to mention the length |
| 501 |
|
assert "8" in messages[0].text |
| 502 |
|
|
| 503 |
|
# warning should mention that something is wrong with the old password |
| 504 |
|
assert "is" in messages[0].text |
| 505 |
|
|
| 506 |
|
# doing changes --> password should not be cleared |
| 507 |
|
assert password_proxy_mock.RootPassword == "aaaa" |
| 508 |
|
|
| 509 |
|
|
| 510 |
|
def test_evaluation_passwd_minlen_crypted_passwd( |
|
@@ 462-483 (lines=22) @@
|
| 459 |
|
assert str(not_wanted) not in messages[0].text |
| 460 |
|
|
| 461 |
|
|
| 462 |
|
def test_evaluation_passwd_minlen_short_passwd( |
| 463 |
|
proxy_getter, rule_data, ksdata_mock, storage_mock): |
| 464 |
|
password_proxy_mock = USERS.get_proxy() |
| 465 |
|
password_proxy_mock.IsRootPasswordCrypted = False |
| 466 |
|
password_proxy_mock.RootPassword = "aaaa" |
| 467 |
|
|
| 468 |
|
rule_data.new_rule("passwd --minlen=8") |
| 469 |
|
|
| 470 |
|
messages = rule_data.eval_rules(ksdata_mock, storage_mock, report_only=False) |
| 471 |
|
|
| 472 |
|
# minimal password length greater than actual length --> one warning |
| 473 |
|
assert len(messages) == 1 |
| 474 |
|
assert messages[0].type == common.MESSAGE_TYPE_FATAL |
| 475 |
|
|
| 476 |
|
# warning has to mention the length |
| 477 |
|
assert "8" in messages[0].text |
| 478 |
|
|
| 479 |
|
# warning should mention that something is wrong with the old password |
| 480 |
|
assert "is" in messages[0].text |
| 481 |
|
|
| 482 |
|
# doing changes --> password should not be cleared |
| 483 |
|
assert password_proxy_mock.RootPassword == "aaaa" |
| 484 |
|
|
| 485 |
|
|
| 486 |
|
def test_evaluation_passwd_minlen_short_passwd_report_only( |