test_workflow_view.py 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import json
  2. from django.test import TestCase
  3. from tests.base import LoonflowApiCall
  4. class TestWorkflowView(TestCase):
  5. fixtures = ['accounts.json', 'workflows.json']
  6. def test_get_workflow_list_without_arg(self):
  7. """
  8. 获取工作流列表
  9. :return:
  10. """
  11. url = '/api/v1.0/workflows'
  12. response_content_dict = LoonflowApiCall().api_call('get', url)
  13. self.assertEqual(response_content_dict.get('code'), 0)
  14. self.assertGreater(len(response_content_dict.get('data')), 1)
  15. def test_get_workflow_init_state(self):
  16. """
  17. 获取工作流初始状态
  18. :return:
  19. """
  20. workflow_id = 1
  21. url = '/api/v1.0/workflows/{}/init_state'.format(workflow_id)
  22. response_content_dict = LoonflowApiCall().api_call('get', url)
  23. self.assertEqual(response_content_dict.get('code'), 0)
  24. def test_get_workflow_states(self):
  25. """
  26. 获取工作流状态列表
  27. :return:
  28. """
  29. workflow_id = 1
  30. url = '/api/v1.0/workflows/{}/states'.format(workflow_id)
  31. response_content_dict = LoonflowApiCall().api_call('get', url)
  32. self.assertEqual(response_content_dict.get('code'), 0)
  33. def test_get_workflow_state_detail(self):
  34. """
  35. 获取状态详情
  36. :return:
  37. """
  38. state_id = 3
  39. url = '/api/v1.0/workflows/states/{}'.format(state_id)
  40. response_content_dict = LoonflowApiCall().api_call('get', url)
  41. self.assertEqual(response_content_dict.get('code'), 0)