def test_add_executor_info(): mock_mesos_task = mock.Mock() mock_executor = { 'tasks': [mock_mesos_task], 'some': 'thing', 'completed_tasks': [mock_mesos_task], 'queued_tasks': [mock_mesos_task], } mock_task = mock.Mock( _Task__items={'a': 'thing'}, executor=mock_executor, ) ret = instance.add_executor_info(mock_task) expected = { 'a': 'thing', 'executor': { 'some': 'thing' }, } assert ret._Task__items == expected with raises(KeyError): ret._Task__items['executor']['completed_tasks'] with raises(KeyError): ret._Task__items['executor']['tasks'] with raises(KeyError): ret._Task__items['executor']['queued_tasks']
def test_add_executor_info(): mock_mesos_task = mock.Mock() mock_executor = { "tasks": [mock_mesos_task], "some": "thing", "completed_tasks": [mock_mesos_task], "queued_tasks": [mock_mesos_task], } mock_task = mock.Mock( _Task__items={"a": "thing"}, executor=asynctest.CoroutineMock( return_value=mock_executor, func=asynctest.CoroutineMock( ), # https://github.com/notion/a_sync/pull/40 ), ) ret = instance.add_executor_info(mock_task) expected = {"a": "thing", "executor": {"some": "thing"}} assert ret._Task__items == expected with pytest.raises(KeyError): ret._Task__items["executor"]["completed_tasks"] with pytest.raises(KeyError): ret._Task__items["executor"]["tasks"] with pytest.raises(KeyError): ret._Task__items["executor"]["queued_tasks"]
def test_add_executor_info(): mock_mesos_task = mock.Mock() mock_executor = { 'tasks': [mock_mesos_task], 'some': 'thing', 'completed_tasks': [mock_mesos_task], 'queued_tasks': [mock_mesos_task], } mock_task = mock.Mock( _Task__items={'a': 'thing'}, executor=asynctest.CoroutineMock( return_value=mock_executor, func=asynctest.CoroutineMock(), # https://github.com/notion/a_sync/pull/40 ), ) ret = instance.add_executor_info(mock_task) expected = { 'a': 'thing', 'executor': {'some': 'thing'}, } assert ret._Task__items == expected with raises(KeyError): ret._Task__items['executor']['completed_tasks'] with raises(KeyError): ret._Task__items['executor']['tasks'] with raises(KeyError): ret._Task__items['executor']['queued_tasks']
def test_add_executor_info(): mock_mesos_task = mock.Mock() mock_executor = {'tasks': [mock_mesos_task], 'some': 'thing', 'completed_tasks': [mock_mesos_task], 'queued_tasks': [mock_mesos_task]} mock_task = mock.Mock(_Task__items={'a': 'thing'}, executor=mock_executor) ret = instance.add_executor_info(mock_task) expected = {'a': 'thing', 'executor': {'some': 'thing'}} assert ret._Task__items == expected with raises(KeyError): ret._Task__items['executor']['completed_tasks'] with raises(KeyError): ret._Task__items['executor']['tasks'] with raises(KeyError): ret._Task__items['executor']['queued_tasks']