def test_list_components_leader(mocked_get, mocked_dns, mocked_get_config_val): m = mock.MagicMock() m.json.return_value = { 'units': [{ 'id': 'dcos-component.service', }] } mocked_dns().hosts.return_value = [{'ip': '10.10.0.1'}] mocked_get_config_val.return_value = 'http://10.10.10.10' mocked_get.return_value = m main._list_components(True, False, False) mocked_get.assert_called_with( 'http://10.10.10.10/system/health/v1/nodes/10.10.0.1/units')
def test_list_components(mocked_get, mocked_get_slave_ip, mocked_get_config_val): m = mock.MagicMock() m.json.return_value = { 'units': [{ 'id': 'dcos-component.service', }] } mocked_get.return_value = m mocked_get_slave_ip.return_value = '127.0.0.1' mocked_get_config_val.return_value = 'http://10.10.10.10' main._list_components(None, 'slave-id', False) mocked_get.assert_called_with( 'http://10.10.10.10/system/health/v1/nodes/127.0.0.1/units')
def test_list_components(mocked_get, mocked_get_slave_ip, mocked_get_config_val): m = mock.MagicMock() m.json.return_value = { 'units': [ { 'id': 'dcos-component.service', } ] } mocked_get.return_value = m mocked_get_slave_ip.return_value = '127.0.0.1' mocked_get_config_val.return_value = 'http://10.10.10.10' main._list_components(None, 'slave-id', False) mocked_get.assert_called_with( 'http://10.10.10.10/system/health/v1/nodes/127.0.0.1/units')
def test_list_components_leader(mocked_get, mocked_dns, mocked_get_config_val): m = mock.MagicMock() m.json.return_value = { 'units': [ { 'id': 'dcos-component.service', } ] } mocked_dns().hosts.return_value = [{'ip': '10.10.0.1'}] mocked_get_config_val.return_value = 'http://10.10.10.10' mocked_get.return_value = m main._list_components(True, False, False) mocked_get.assert_called_with( 'http://10.10.10.10/system/health/v1/nodes/10.10.0.1/units')