Example #1
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 #2
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'
Example #3
0
 def test_get_action_db(self, mock_get_action_by_id):
     action_resource = ActionsStepsResource()
     action_id = '123456789'
     action_resource.get_action_db(action_id)
     mock_get_action_by_id.assert_called_with(action_id=action_id)