Skip to content

Commit 0448a20

Browse files
feat: temporary remove session token tests
Those tests will be added back after the session certificate flag is removed from the server
1 parent 523eeea commit 0448a20

1 file changed

Lines changed: 1 addition & 119 deletions

File tree

test/test_tanker.py

Lines changed: 1 addition & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,7 @@
3030
SharingOptions,
3131
)
3232
from tankersdk import Status as TankerStatus
33-
from tankersdk import (
34-
Tanker,
35-
VerificationKeyVerification,
36-
VerificationMethodType,
37-
VerificationOptions,
38-
error,
39-
)
33+
from tankersdk import Tanker, VerificationKeyVerification, VerificationMethodType, error
4034

4135

4236
def encode(string: str) -> str:
@@ -1471,115 +1465,3 @@ def test_prehash_password_vector_2() -> None:
14711465
input = "test éå 한국어 😃"
14721466
expected = "Pkn/pjub2uwkBDpt2HUieWOXP5xLn0Zlen16ID4C7jI="
14731467
assert tankersdk.prehash_password(input) == expected
1474-
1475-
1476-
def check_session_token(
1477-
app_id: str,
1478-
auth_token: str,
1479-
public_identity: str,
1480-
session_token: str,
1481-
allowed_method: str,
1482-
) -> str:
1483-
url = TEST_CONFIG["server"]["trustchaindUrl"] + "/verification/session-token"
1484-
response = requests.post(
1485-
url,
1486-
headers={"content-type": "application/json"},
1487-
json={
1488-
"app_id": app_id,
1489-
"auth_token": auth_token,
1490-
"public_identity": public_identity,
1491-
"session_token": session_token,
1492-
"allowed_methods": [{"type": allowed_method}],
1493-
},
1494-
)
1495-
response.raise_for_status()
1496-
return response.json()["verification_method"] # type: ignore
1497-
1498-
1499-
@pytest.mark.asyncio
1500-
async def test_get_session_token_with_register_identity(
1501-
tmp_path: Path, app: Dict[str, str], admin: Admin
1502-
) -> None:
1503-
admin.update_app(
1504-
app["id"],
1505-
session_certificates=True,
1506-
)
1507-
1508-
passphrase = "50lbs bags of white rocks"
1509-
tanker = create_tanker(app["id"], persistent_path=tmp_path)
1510-
identity = tankersdk_identity.create_identity(
1511-
app["id"], app["secret"], str(uuid.uuid4())
1512-
)
1513-
await tanker.start(identity)
1514-
1515-
options = VerificationOptions(with_session_token=True)
1516-
token = await tanker.register_identity(PassphraseVerification(passphrase), options)
1517-
assert token
1518-
1519-
expected_method = "passphrase"
1520-
public_identity = tankersdk_identity.get_public_identity(identity)
1521-
actual_method = check_session_token(
1522-
app["id"], app["auth_token"], public_identity, token, expected_method
1523-
)
1524-
assert expected_method == actual_method
1525-
await tanker.stop()
1526-
1527-
1528-
@pytest.mark.asyncio
1529-
async def test_get_session_token_with_verify_identity(
1530-
tmp_path: Path, app: Dict[str, str], admin: Admin
1531-
) -> None:
1532-
admin.update_app(
1533-
app["id"],
1534-
session_certificates=True,
1535-
)
1536-
1537-
tanker = create_tanker(app["id"], persistent_path=tmp_path)
1538-
identity = tankersdk_identity.create_identity(
1539-
app["id"], app["secret"], str(uuid.uuid4())
1540-
)
1541-
await tanker.start(identity)
1542-
1543-
verif = PassphraseVerification("What the stones are for")
1544-
options = VerificationOptions(with_session_token=True)
1545-
await tanker.register_identity(verif)
1546-
token = await tanker.verify_identity(verif, options)
1547-
assert token
1548-
1549-
expected_method = "passphrase"
1550-
public_identity = tankersdk_identity.get_public_identity(identity)
1551-
actual_method = check_session_token(
1552-
app["id"], app["auth_token"], public_identity, token, expected_method
1553-
)
1554-
assert expected_method == actual_method
1555-
await tanker.stop()
1556-
1557-
1558-
@pytest.mark.asyncio
1559-
async def test_get_session_token_with_set_verification_method(
1560-
tmp_path: Path, app: Dict[str, str], admin: Admin
1561-
) -> None:
1562-
admin.update_app(
1563-
app["id"],
1564-
session_certificates=True,
1565-
)
1566-
1567-
tanker = create_tanker(app["id"], persistent_path=tmp_path)
1568-
identity = tankersdk_identity.create_identity(
1569-
app["id"], app["secret"], str(uuid.uuid4())
1570-
)
1571-
await tanker.start(identity)
1572-
1573-
verif = PassphraseVerification("Still carrying the rock")
1574-
options = VerificationOptions(with_session_token=True)
1575-
await tanker.register_identity(verif)
1576-
token = await tanker.set_verification_method(verif, options)
1577-
assert token
1578-
1579-
expected_method = "passphrase"
1580-
public_identity = tankersdk_identity.get_public_identity(identity)
1581-
actual_method = check_session_token(
1582-
app["id"], app["auth_token"], public_identity, token, expected_method
1583-
)
1584-
assert expected_method == actual_method
1585-
await tanker.stop()

0 commit comments

Comments
 (0)