test_conversation_variable.py 718 B

123456789101112131415161718192021222324252627
  1. from uuid import uuid4
  2. from core.variables import SegmentType
  3. from factories import variable_factory
  4. from models import ConversationVariable
  5. def test_from_variable_and_to_variable():
  6. variable = variable_factory.build_conversation_variable_from_mapping(
  7. {
  8. "id": str(uuid4()),
  9. "name": "name",
  10. "value_type": SegmentType.OBJECT,
  11. "value": {
  12. "key": {
  13. "key": "value",
  14. }
  15. },
  16. }
  17. )
  18. conversation_variable = ConversationVariable.from_variable(
  19. app_id="app_id", conversation_id="conversation_id", variable=variable
  20. )
  21. assert conversation_variable.to_variable() == variable