test_conversation_variable.py 669 B

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