def test_create_model_type_lazy_docstring(mock_create_docstring):
    # NOTE: some sort of weird interaction with pytest, pytest-mock and mock
    #       made using the 'mocker' fixture here a no-go.
    definitions_spec = definitions_spec_fixture()
    pet_spec = pet_spec_fixture(definitions_spec)
    pet_type = create_model_type('Pet', pet_spec)
    assert not mock_create_docstring.called
    assert pet_type.__doc__ == mock_create_docstring.return_value
    mock_create_docstring.assert_called_once_with(pet_spec)
def test_create_model_type_lazy_docstring(mock_create_docstring,
                                          empty_swagger_spec):
    # NOTE: some sort of weird interaction with pytest, pytest-mock and mock
    #       made using the 'mocker' fixture here a no-go.
    definitions_spec = definitions_spec_fixture()
    pet_spec = pet_spec_fixture(definitions_spec)
    pet_type = create_model_type(empty_swagger_spec, 'Pet', pet_spec)
    assert mock_create_docstring.call_count == 0
    assert pet_type.__doc__ == mock_create_docstring.return_value
    assert mock_create_docstring.call_count == 1
Exemplo n.º 3
0
def test_create_model_type_lazy_docstring(mock_create_docstring,
                                          empty_swagger_spec):
    # NOTE: some sort of weird interaction with pytest, pytest-mock and mock
    #       made using the 'mocker' fixture here a no-go.
    definitions_spec = definitions_spec_fixture()
    pet_spec = pet_spec_fixture(definitions_spec)
    pet_type = create_model_type(empty_swagger_spec, 'Pet', pet_spec)
    assert mock_create_docstring.call_count == 0
    assert pet_type.__doc__ == mock_create_docstring.return_value
    assert mock_create_docstring.call_count == 1