Skip to content

Commit d510164

Browse files
committed
Revert "Restructure the documentation, merge READMEs"
This reverts commit b4693fc.
1 parent b4693fc commit d510164

File tree

9 files changed

+163
-221
lines changed

9 files changed

+163
-221
lines changed

CONTRIBUTING.md

Lines changed: 0 additions & 22 deletions
This file was deleted.

README.md

Lines changed: 78 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
# Python WireMock
1+
# Python WireMock Admin API Client
22

33
<p align="center">
44
<a href="https://wiremock.org/docs/solutions/python/" target="_blank">
55
<img width="512px" src="docs/images/python-wiremock-horizontal.png" alt="WireMock Logo"/>
66
</a>
77
</p>
88

9-
Python WireMock is a library that allows users to interact with a WireMock instance from within a Python project.
10-
Full documentation can be found at [wiremock.readthedocs.org](http://wiremock.readthedocs.org/).
9+
Python Wiremock is an HTTP client that allows users to interact with a Wiremock instance from within a Python project.
1110

1211
[![a](https://img.shields.io/badge/slack-%23wiremock%2Fpython-brightgreen?style=flat&logo=slack)](https://slack.wiremock.org/)
1312
[![Docs](https://img.shields.io/badge/docs-latest-brightgreen.svg)](http://wiremock.readthedocs.org/)
@@ -21,22 +20,91 @@ FIXME: Reporting is dead: https://github.com/wiremock/python-wiremock/issues/74
2120

2221
WireMock can run in unit tests, as a standalone process or a container. Key features include:
2322

24-
- [Testcontainers Python](https://github.com/testcontainers/testcontainers-python) module to easily start WireMock server for your tests
25-
- REST API Client for a standalone WireMock Java server
2623
- Supports most of the major [Wiremock](https://wiremock.org/docs) features (more on their way soon)
24+
- Support for [testcontainers-python](https://github.com/testcontainers/testcontainers-python) to easily start wiremock server for your tests
25+
- Support for standalone wiremock JAVA sever
2726

28-
## References
27+
## Install as Dependency
2928

30-
- [Quickstart Guide](./docs/quickstart)
31-
- [Installation](./docs/install)
32-
- [Full documentation](http://wiremock.readthedocs.org/)
29+
To install:
30+
31+
`pip install wiremock`
32+
33+
To install with testing dependencies:
34+
35+
`pip install wiremock[testing]`
36+
37+
To install via Poetry:
38+
39+
`poetry add --extras=testing wiremock`
40+
41+
## Quick Start
42+
43+
The preferred way of using WireMock to mock your services is by using the provided `WireMockContainer` [testcontainers-python](https://github.com/testcontainers/testcontainers-python).
44+
45+
```python
46+
import pytest
47+
48+
from wiremock.testing.testcontainer import wiremock_container
49+
50+
@pytest.fixture(scope="session") # (1)
51+
def wm_server():
52+
with wiremock_container(secure=False) as wm:
53+
54+
Config.base_url = wm.get_url("__admin") # (2)
55+
56+
Mappings.create_mapping(
57+
Mapping(
58+
request=MappingRequest(method=HttpMethods.GET, url="/hello"),
59+
response=MappingResponse(status=200, body="hello"),
60+
persistent=False,
61+
)
62+
) # (3)
63+
yield wm
64+
65+
66+
def test_get_hello_world(wm_server): # (4)
67+
68+
resp1 = requests.get(wm_server.get_url("/hello"), verify=False)
69+
70+
assert resp1.status_code == 200
71+
assert resp1.content == b"hello"
72+
```
73+
74+
1. Create a pytest fixture to manage the container life-cycle. use fixture `scope` to control how often the container is created
75+
76+
2. Set the wiremock sdk config url to the url exposed by the container
77+
78+
3. Create response and request mappings using the Admin SDK.
79+
80+
4. Use the `wm_server` fixture in your tests and make requests against the mock server.
81+
82+
You can read more about Testcontainers support in python-wiremock [here](docs/testcontainers.md).
3383

3484
## Examples
3585

3686
There are several example projects included to demonstrate the different ways that wiremock can be used to mock
3787
services in your tests and systems. The example test modules demonstrate different strategies for testing against
3888
the same "product service" and act as a good demonstration of real world applications to help you get started.
3989

40-
- [Testcontainers Python](example/tests/test_testcontainers.py)
90+
- [Python Testcontainers](example/tests/test_testcontainers.py)
4191

4292
- [Standalone Java Server Version](example/tests/test_java_server.py)
93+
94+
## Documentation
95+
96+
wiremock documentation can be found at http://wiremock.readthedocs.org/
97+
98+
## Pull Requests
99+
100+
General Rules:
101+
102+
- All Tests must pass
103+
- Coverage shouldn't decrease
104+
- All Pull Requests should be rebased against master **before** submitting the PR.
105+
106+
## Development
107+
108+
Setup the project using poetry.
109+
110+
`poetry install`

docs/api-client.md

Lines changed: 0 additions & 73 deletions
This file was deleted.

docs/changelog.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ ChangeLog
33

44
Changes to the library are recorded here.
55

6-
Newer version
7-
------
8-
9-
See [GitHub Releases](https://github.com/wiremock/python-wiremock/releases)
10-
116
v2.4.0
127
------
138

docs/index.md

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,46 @@
1-
# Python WireMock
1+
Python client for WireMock standalone Admin API
2+
=====
23

3-
Python WireMock is an HTTP client that allows users to interact with a WireMock instance from within a Python project.
4+
This library provides a HTTP client to the WireMock standalone server's
5+
admin API.
46

5-
[![a](https://img.shields.io/badge/slack-%23wiremock%2Fpython-brightgreen?style=flat&logo=slack)](https://slack.wiremock.org/)
7+
Links
8+
=====
69

7-
## Key Features
10+
- WireMock Standalone: <https://wiremock.org/docs/standalone/>
11+
- Documentation: <https://wiremock.readthedocs.io/en/latest/>
12+
- Official Repository:
13+
<https://github.com/wiremock/python-wiremock.git>
14+
- Package: TODO
815

9-
WireMock can run in unit tests, as a standalone process or a container, or in the cloud.
10-
Python WireMock enables all these usage modes.
11-
Key features include:
16+
Requirements
17+
============
1218

13-
- [Testcontainers Python](https://github.com/testcontainers/testcontainers-python) module to easily start WireMock server for your tests
14-
- REST API Client for a standalone WireMock Java server
15-
- Supports most of the major [Wiremock](https://wiremock.org/docs) features (more on their way soon)
19+
wiremock is known to support Python 3.7.
1620

17-
## Documentation
21+
Download
22+
========
1823

19-
- [Quickstart](./quickstart)
20-
- [Installation](./install)
21-
- [Testconatiners module](./testcontainers)
22-
- [Using with standalone WireMock](./api-client)
24+
PyPI: TODO
2325

24-
## Links
26+
```bash
27+
$ pip install wiremock
28+
```
2529

26-
- WireMock Standalone: <https://wiremock.org/docs/standalone/>
27-
- Documentation: <https://wiremock.readthedocs.io/en/latest/>
28-
- Official Repository: <https://github.com/wiremock/python-wiremock.git>
29-
- Package: <https://pypi.org/project/wiremock>
30+
Source: <https://github.com/wiremock/python-wiremock.git>
3031

31-
<!--
32+
```bash
33+
$ git clone TODO
34+
$ poetry install
35+
```
3236

3337
Contents
3438
========
3539

3640
Indices and tables
3741
------------------
3842

39-
43+
<!--
4044
* :ref:`genindex`
4145
* :ref:`modindex`
4246
* :ref:`search`

docs/install.md

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)