(self)
| 564 | |
| 565 | @unittest.skipUnless(HAVE_STRINGPREP, "Cannot test without stringprep") |
| 566 | def test_scram_saslprep(self): |
| 567 | # Step 4: test SASLprep |
| 568 | host, port = client_context.host, client_context.port |
| 569 | # Test the use of SASLprep on passwords. For example, |
| 570 | # saslprep('\u2136') becomes 'IV' and saslprep('I\u00ADX') |
| 571 | # becomes 'IX'. SASLprep is only supported when the standard |
| 572 | # library provides stringprep. |
| 573 | client_context.create_user( |
| 574 | "testscram", "\u2168", "\u2163", roles=["dbOwner"], mechanisms=["SCRAM-SHA-256"] |
| 575 | ) |
| 576 | client_context.create_user( |
| 577 | "testscram", "IX", "IX", roles=["dbOwner"], mechanisms=["SCRAM-SHA-256"] |
| 578 | ) |
| 579 | |
| 580 | client = self.rs_or_single_client_noauth( |
| 581 | username="\u2168", password="\u2163", authSource="testscram" |
| 582 | ) |
| 583 | client.testscram.command("dbstats") |
| 584 | |
| 585 | client = self.rs_or_single_client_noauth( |
| 586 | username="\u2168", |
| 587 | password="\u2163", |
| 588 | authSource="testscram", |
| 589 | authMechanism="SCRAM-SHA-256", |
| 590 | ) |
| 591 | client.testscram.command("dbstats") |
| 592 | |
| 593 | client = self.rs_or_single_client_noauth( |
| 594 | username="\u2168", password="IV", authSource="testscram" |
| 595 | ) |
| 596 | client.testscram.command("dbstats") |
| 597 | |
| 598 | client = self.rs_or_single_client_noauth( |
| 599 | username="IX", password="I\u00ADX", authSource="testscram" |
| 600 | ) |
| 601 | client.testscram.command("dbstats") |
| 602 | |
| 603 | client = self.rs_or_single_client_noauth( |
| 604 | username="IX", |
| 605 | password="I\u00ADX", |
| 606 | authSource="testscram", |
| 607 | authMechanism="SCRAM-SHA-256", |
| 608 | ) |
| 609 | client.testscram.command("dbstats") |
| 610 | |
| 611 | client = self.rs_or_single_client_noauth( |
| 612 | username="IX", password="IX", authSource="testscram", authMechanism="SCRAM-SHA-256" |
| 613 | ) |
| 614 | client.testscram.command("dbstats") |
| 615 | |
| 616 | client = self.rs_or_single_client_noauth( |
| 617 | "mongodb://\u2168:\u2163@%s:%d/testscram" % (host, port) |
| 618 | ) |
| 619 | client.testscram.command("dbstats") |
| 620 | client = self.rs_or_single_client_noauth( |
| 621 | "mongodb://\u2168:IV@%s:%d/testscram" % (host, port) |
| 622 | ) |
| 623 | client.testscram.command("dbstats") |
nothing calls this directly
no test coverage detected