# Path: disparity/apps/salary/utils.py
# def generate_survey_token(seed, prime_identifier, is_admin, survey_id):
#     return signing.dumps({
#         'seed': seed,
#         'prime_identifier': prime_identifier,
#         'is_admin': is_admin,
#         'survey_id': str(survey_id),
#         'expires_at': str(timezone.now() + timezone.timedelta(seconds=SURVEY_TOKEN_MAX_AGE)),
#     }, salt=SURVEY_TOKEN_SALT)
# 
# def unsign_survey_token(token):
#     data = signing.loads(
#         token, salt=SURVEY_TOKEN_SALT, max_age=SURVEY_TOKEN_MAX_AGE,
#     )
#     expires_at_str = data.pop('expires_at')
#     data['expires_at'] = parser.parse(expires_at_str)
#     return data


import pytest
from disparity.apps.salary.utils import (
    generate_survey_token,
    unsign_survey_token,
)



def test_token_round_trip():
    data_in = {
        'seed': 12345,
        'is_admin': True,
        'prime_identifier': 5,
        'survey_id': 'some-id',
    }
    token = generate_survey_token(**data_in)

# Path: disparity/apps/salary/utils.py
# def generate_survey_token(seed, prime_identifier, is_admin, survey_id):
#     return signing.dumps({
#         'seed': seed,
#         'prime_identifier': prime_identifier,
#         'is_admin': is_admin,
#         'survey_id': str(survey_id),
#         'expires_at': str(timezone.now() + timezone.timedelta(seconds=SURVEY_TOKEN_MAX_AGE)),
#     }, salt=SURVEY_TOKEN_SALT)
# 
# def unsign_survey_token(token):
#     data = signing.loads(
#         token, salt=SURVEY_TOKEN_SALT, max_age=SURVEY_TOKEN_MAX_AGE,
#     )
#     expires_at_str = data.pop('expires_at')
#     data['expires_at'] = parser.parse(expires_at_str)
#     return data


# Path: tests/salary/test_survey_token_generation.py
import pytest
from disparity.apps.salary.utils import (
    generate_survey_token,
    unsign_survey_token,
)




def test_token_round_trip():
    data_in = {
        'seed': 12345,
        'is_admin': True,
        'prime_identifier': 5,
        'survey_id': 'some-id',
    }
    token = generate_survey_token(**data_in)

    data_out = unsign_survey_token(token)