示例#1
0
def test_reserve(mock_operator_api, mock_build_reservation_payload):
    fake_slave_id = "fake-id"
    fake_resource = "cpus"
    fake_amount = 42
    resources = [Resource(name=fake_resource, amount=fake_amount)]
    reserve(fake_slave_id, resources)
    assert mock_build_reservation_payload.call_count == 1
    expected_args = mock.call(resources)
    assert mock_build_reservation_payload.call_args == expected_args

    assert mock_operator_api.call_count == 1
    assert mock_operator_api.return_value.call_count == 1
示例#2
0
def test_reserve(
    mock_reserve_api,
    mock_build_reservation_payload,
):
    fake_slave_id = 'fake-id'
    fake_resource = 'cpus'
    fake_amount = 42
    resources = [Resource(name=fake_resource, amount=fake_amount)]
    reserve(fake_slave_id, resources)
    assert mock_build_reservation_payload.call_count == 1
    expected_args = mock.call(resources)
    assert mock_build_reservation_payload.call_args == expected_args

    assert mock_reserve_api.call_count == 1
    assert mock_reserve_api.return_value.call_count == 1