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