MCPcopy Create free account
hub / github.com/mongodb/mongo-python-driver / test_saslprep

Method test_saslprep

test/test_saslprep.py:26–44  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

24
25class TestSASLprep(unittest.TestCase):
26 def test_saslprep(self):
27 try:
28 import stringprep
29 except ImportError:
30 self.assertRaises(TypeError, saslprep, "anything...")
31 # Bytes strings are ignored.
32 self.assertEqual(saslprep(b"user"), b"user")
33 else:
34 # Examples from RFC4013, Section 3.
35 self.assertEqual(saslprep("I\u00ADX"), "IX")
36 self.assertEqual(saslprep("user"), "user")
37 self.assertEqual(saslprep("USER"), "USER")
38 self.assertEqual(saslprep("\u00AA"), "a")
39 self.assertEqual(saslprep("\u2168"), "IX")
40 self.assertRaises(ValueError, saslprep, "\u0007")
41 self.assertRaises(ValueError, saslprep, "\u0627\u0031")
42
43 # Bytes strings are ignored.
44 self.assertEqual(saslprep(b"user"), b"user")

Callers

nothing calls this directly

Calls 1

saslprepFunction · 0.90

Tested by

no test coverage detected