MCPcopy
hub / github.com/psycopg/psycopg / test_encrypt_password_query

Function test_encrypt_password_query

tests/pq/test_pgconn.py:727–736  ·  view source on GitHub ↗
(pgconn)

Source from the content-addressed store, hash-verified

725@pytest.mark.libpq(">= 10")
726@pytest.mark.crdb_skip("password_encryption")
727def test_encrypt_password_query(pgconn):
728 res = pgconn.exec_(b"set password_encryption to 'md5'")
729 assert res.status == pq.ExecStatus.COMMAND_OK, pgconn.get_error_message()
730 enc = pgconn.encrypt_password(b"psycopg2", b"ashesh")
731 assert enc == b"md594839d658c28a357126f105b9cb14cfc"
732
733 res = pgconn.exec_(b"set password_encryption to 'scram-sha-256'")
734 assert res.status == pq.ExecStatus.COMMAND_OK
735 enc = pgconn.encrypt_password(b"psycopg2", b"ashesh")
736 assert enc.startswith(b"SCRAM-SHA-256$")
737
738
739@pytest.mark.libpq(">= 10")

Callers

nothing calls this directly

Calls 3

exec_Method · 0.45
get_error_messageMethod · 0.45
encrypt_passwordMethod · 0.45

Tested by

no test coverage detected