Example #1
0
 def test_get_action_step_error_action(self):
     """Validate ApiError, 'Action not found' is raised"""
     action_resource = ActionsStepsResource()
     with patch.object(ActionsStepsResource,
                       'get_action_db') as mock_method:
         mock_method.return_value = None
         with pytest.raises(ApiError) as api_error:
             action_resource.get_action_step(
                 '59bb330a-9e64-49be-a586-d253bb67d443', 'cheese')
         assert 'Action not found' in str(api_error)
Example #2
0
    def test_get_action_step_error_step(self):
        """Validate ApiError, 'Step not found' is raised"""
        action_resource = ActionsStepsResource()
        # stubs for db
        action_resource.get_action_db = actions_db
        action_resource.get_tasks_db = tasks_db

        with pytest.raises(ApiError) as api_error:
            step = action_resource.get_action_step(
                '59bb330a-9e64-49be-a586-d253bb67d443', 'cheese')
        assert 'Step not found' in str(api_error)
Example #3
0
    def test_get_action_step_success(self):
        """Tests the main response from get all actions"""
        action_resource = ActionsStepsResource()
        # stubs for db
        action_resource.get_action_db = actions_db
        action_resource.get_tasks_db = tasks_db

        step = action_resource.get_action_step(
            '59bb330a-9e64-49be-a586-d253bb67d443', '1c')
        assert step['index'] == 3
        assert step['try_number'] == '3'
        assert step['operator'] == 'smooth'