Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restructure the documentation, merge READMEs
- Loading branch information
1 parent
85c4eaa
commit b4693fc
Showing
9 changed files
with
221 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Contributing to Python WireMock | ||
|
||
[![a](https://img.shields.io/badge/slack-%23wiremock%2Fpython-brightgreen?style=flat&logo=slack)](https://slack.wiremock.org/) | ||
|
||
## Get Started | ||
|
||
1. Join us ion the `#wiremock-python` channel on the [WireMock Slack](https://slack.wiremock.org/) | ||
2. Check out the GitHub issues! | ||
|
||
## Pull Requests | ||
|
||
General Rules: | ||
|
||
- All Tests must pass | ||
- Coverage shouldn't decrease | ||
- All Pull Requests should be rebased against master **before** submitting the PR. | ||
|
||
## Development | ||
|
||
Setup the project using poetry. | ||
|
||
`poetry install` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
Using with a Standalone WireMock | ||
=========== | ||
|
||
An example app: | ||
|
||
```python | ||
from wiremock.constants import Config | ||
from wiremock.client import * | ||
|
||
Config.base_url = 'https://mockserver.example.com/__admin/' | ||
# Optionally set a custom cert path: | ||
# Config.requests_cert = ... (See requests documentation) | ||
# Optionally disable cert verification | ||
# Config.requests_verify = False | ||
|
||
mapping = Mapping( | ||
priority=100, | ||
request=MappingRequest( | ||
method=HttpMethods.GET, | ||
url='/hello' | ||
), | ||
response=MappingResponse( | ||
status=200, | ||
body='hi' | ||
), | ||
persistent=False, | ||
) | ||
|
||
mapping = Mappings.create_mapping(mapping=mapping) | ||
|
||
all_mappings = Mappings.retrieve_all_mappings() | ||
``` | ||
|
||
### Starting WireMock server with a context manager | ||
|
||
```python | ||
from wiremock.constants import Config | ||
from wiremock.client import * | ||
from wiremock.server.server import WireMockServer | ||
|
||
with WireMockServer() as wm: | ||
Config.base_url = 'http://localhost:{}/__admin'.format(wm.port) | ||
Mappings.create_mapping(...) # Set up stubs | ||
requests.get(...) # Make API calls | ||
``` | ||
|
||
### Starting WireMock server in a unittest.TestCase | ||
|
||
```python | ||
|
||
class MyTestClassBase(TestCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
wm = self.wiremock_server = WireMockServer() | ||
wm.start() | ||
Config.base_url = 'http://localhost:{}/__admin'.format(wm.port) | ||
|
||
@classmethod | ||
def tearDownClass(cls): | ||
self.wiremock_server.stop() | ||
``` | ||
|
||
### Customizing the path to java | ||
|
||
```python | ||
WireMockServer(java_path='/path/to/my/java') | ||
``` | ||
|
||
### Customizing the WireMock server JAR file: | ||
|
||
```python | ||
WireMockServer(jar_path='/my/secret/location/wiremock-standalone-2.35.0.jar') | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Installation | ||
|
||
## Requirements | ||
|
||
Python WireMock is known to support Python 3.7 or above. | ||
|
||
## Pip | ||
|
||
To install: | ||
|
||
`pip install wiremock` | ||
|
||
To install with testing dependencies: | ||
|
||
`pip install wiremock[testing]` | ||
|
||
## Poetry | ||
|
||
To install via Poetry: | ||
|
||
`poetry add wiremock` | ||
|
||
Or: | ||
|
||
```bash | ||
git clone [TODO](https://github.com/wiremock/python-wiremock.git) | ||
poetry install | ||
``` | ||
|
||
To install with testing dependencies: | ||
|
||
`poetry add --extras=testing wiremock` |
Oops, something went wrong.