You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+76-77
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
## Overview
4
4
5
-
Pytest fixtures to instantiate and populated local docker GIT SCMs, using [lovely-pytest-docker](https://pypi.org/project/lovely-pytest-docker), for testing.
5
+
Pytest fixtures to instantiate and populated local GIT SCMs, using [lovely-pytest-docker](https://pypi.org/project/lovely-pytest-docker), for testing.
6
6
7
7
## Getting Started
8
8
@@ -21,12 +21,12 @@ All fixtures should be automatically included via the <tt>pytest11</tt> entry po
21
21
import pytest
22
22
import subprocess
23
23
from pathlib import Path
24
-
frompytest_docker_git_fixturesimportDockerGITInsecure, DockerGITSecure# Optional, for typing
24
+
frompytest_git_fixturesimportGITInsecure, GITSecure# Optional, for typing
This fixture uses the `docker_compose_files` fixture to locate a user-defined docker-compose configuration file (typically <tt>tests/docker-compose.yml</tt>) that contains the <tt>pytest-docker-git-insecure</tt> service. If one cannot be located, an embedded configuration is copied to a temporary location and returned. This fixture is used to instantiate the insecure docker GIT service.
78
+
Retrieves an HTTP basic authentication header that is populated with credentials that can access the secure GIT service. The credentials are retrieved from the [git_password](#git_password)and [git_username](#git_username) fixtures.
This fixture uses the `docker_compose_files` fixture to locate a user-defined docker-compose configuration file (typically <tt>tests/docker-compose.yml</tt>) that contains the <tt>pytest-docker-git-secure</tt> service. If one cannot be located, an embedded configuration is copied to a temporary location and returned. This fixture is used to instantiate the secure docker GIT service; however, unlike the configuration returned by the [docker_compose_insecure](#docker_compose_insecure) fixture, this configuration will be treated as a template; the <tt>$PATH_CERTIFICATE</tt>, <tt>$PATH_HTPASSWD</tt>, and <tt>$PATH_KEY</tt> tokens will be populated with the absolute paths provided by the [docker_git_certs](#docker_git_certs) and [docker_git_htpasswd](#docker_git_htpasswd) fixtures, as appropriate.
82
+
Locates a user-defined CA trust store (<tt>tests/cacerts</tt>) to use to verify connections to the secure GIT service. If one cannot be located, a temporary trust store is created containing certificates from <tt>certifi</tt>and the [git_certs](#git_certs) fixture. This fixture is used to instantiate the secure GIT service.
Retrieves an HTTP basic authentication header that is populated with credentials that can access the secure docker GIT service. The credentials are retrieved from the [docker_git_password](#docker_git_password) and [docker_git_username](#docker_git_username) fixtures.
Locates a user-defined CA trust store (<tt>tests/cacerts</tt>) to use to verify connections to the secure docker GIT service. If one cannot be located, a temporary trust store is created containing certificates from <tt>certifi</tt> and the [docker_git_certs](#docker_git_certs) fixture. This fixture is used to instantiate the secure docker GIT service.
Returns the paths of the self-signed certificate authority certificate, certificate, and private key that are used by the secure docker GIT service. This fixture is used to instantiate the secure docker GIT service.
86
+
Returns the paths of the self-signed certificate authority certificate, certificate, and private key that are used by the secure GIT service. This fixture is used to instantiate the secure GIT service.
95
87
96
88
#### NamedTuple Fields
97
89
@@ -102,25 +94,25 @@ The following fields are defined in the tuple provided by this fixture:
102
94
***certificate** - Path to the certificate.
103
95
***private_key** - Path to the private key.
104
96
105
-
Typing is provided by `pytest_docker_git_fixtures.DockerGITCerts`.
97
+
Typing is provided by `pytest_git_fixtures.GITCerts`.
Provides the path to a htpasswd file that is used by the secure docker GIT service. If a user-defined htpasswd file (<tt>tests/htpasswd</tt>) can be located, it is used. Otherwise, a temporary htpasswd file is created using credentials from the [docker_git_password](#docker_git_password) and [docker_git_username](#docker_git_username) fixtures. This fixture is used to instantiate the secure docker GIT service.
101
+
Provides the path to a htpasswd file that is used by the secure GIT service. If a user-defined htpasswd file (<tt>tests/htpasswd</tt>) can be located, it is used. Otherwise, a temporary htpasswd file is created using credentials from the [git_password](#git_password) and [git_username](#git_username) fixtures. This fixture is used to instantiate the secure GIT service.
This fixture uses the `docker_compose_files` fixture to locate a user-defined docker-compose configuration file (typically <tt>tests/docker-compose.yml</tt>) that contains the <tt>pytest-docker-git-insecure</tt> service. If one cannot be located, an embedded configuration is copied to a temporary location and returned. This fixture is used to instantiate the insecure GIT service.
197
195
198
-
Provides a generated username to use for authentication to the secure docker GIT service.
This fixture uses the `docker_compose_files` fixture to locate a user-defined docker-compose configuration file (typically <tt>tests/docker-compose.yml</tt>) that contains the <tt>pytest-docker-git-secure</tt> service. If one cannot be located, an embedded configuration is copied to a temporary location and returned. This fixture is used to instantiate the secure GIT service; however, unlike the configuration returned by the [pdgf_docker_compose_insecure](#pdgf_docker_compose_insecure) fixture, this configuration will be treated as a template; the <tt>$PATH_CERTIFICATE</tt>, <tt>$PATH_HTPASSWD</tt>, and <tt>$PATH_KEY</tt> tokens will be populated with the absolute paths provided by the [git_certs](#git_certs) and [git_htpasswd](#git_htpasswd) fixtures, as appropriate.
200
199
## <aname="markers"></a>Markers
201
200
202
201
### pytest.mark.create_repo
203
202
204
-
This marker specifies the GIT repository(ies) that should be initialized within the docker GIT service(s) prior to testing. It can ...
203
+
This marker specifies the GIT repository(ies) that should be initialized within the GIT service(s) prior to testing. It can ...
205
204
206
205
... decorate individual tests:
207
206
208
207
```python
209
208
import pytest
210
-
frompytest_docker_git_fixturesimportDockerGITSecure# Optional, for typing
209
+
frompytest_git_fixturesimportGITSecure# Optional, for typing
It is possible to instantiate multiple GIT instances using the corresponding enumerated fixtures. All [fixtures](#fixtures) listed above have _*_list_ (e.g. `docker_git_secure` -> `docker_git_secure_list`) versions that will return enumerated lists of corresponding data type.
255
+
It is possible to instantiate multiple GIT instances using the corresponding enumerated fixtures. All [fixtures](#fixtures) listed above have _*_list_ (e.g. `git_secure` -> `git_secure_list`) versions that will return enumerated lists of corresponding data type.
257
256
258
257
For example:
259
258
260
259
```python
261
260
import requests
262
261
from typing import List # Optional, for typing
263
-
frompytest_docker_git_fixturesimportDockerGITSecure# Optional, for typing
262
+
frompytest_git_fixturesimportGITSecure# Optional, for typing
It is possible to use both singular and enumerated fixtures within the same test context; however, the same values will be returned for the singular fixture as the first enumerated list value (i.e. docker_git_secure == docker_git_secure_list[0]). To avoid complications with lower layers, mainly docker-compose, and to allow for this interchangeability, caching is used internally.
276
+
It is possible to use both singular and enumerated fixtures within the same test context; however, the same values will be returned for the singular fixture as the first enumerated list value (i.e. git_secure == git_secure_list[0]). To avoid complications with lower layers, mainly docker-compose, and to allow for this interchangeability, caching is used internally.
278
277
279
-
By default, the scale factor of the enumerated instances is set to one (n=1). This value can be changed by overriding the `pdrf_scale_factor` fixture, as follows:
278
+
By default, the scale factor of the enumerated instances is set to one (n=1). This value can be changed by overriding the `pdgf_scale_factor` fixture, as follows:
280
279
281
280
```python
282
281
import pytest
283
282
284
283
@pytest.fixture(scope="session")
285
-
defpdrf_scale_factor() -> int:
284
+
defpdgf_scale_factor() -> int:
286
285
return4
287
286
```
288
287
289
-
This fixture will be used to scale both the insecure and secure docker GIT SCMs.
288
+
This fixture will be used to scale both the insecure and secure GIT SCMs.
290
289
291
290
## <aname="limitations"></a>Limitations
292
291
293
292
1. All the fixtures provided by this package are <tt>session</tt> scoped; and will only be executed once per test execution.
294
-
2. The `create_repo`, and `mirror_repo` markers are processed as part of the `docker_git_insecure` and `docker_git_secure` fixtures. As such:
293
+
2. The `create_repo`, and `mirror_repo` markers are processed as part of the `git_insecure` and `git_secure` fixtures. As such:
295
294
*_all_ markers will be aggregated during initialization of the session, and processed prior test execution.
296
-
* Initialized and mirror repositories will be applied to both the insecure and secure docker GIT SCMs, if both are instantiated.
297
-
3. At most 10 insecure and 10 secure docker GIT SCMs are supported using the embedded docker compose.
298
-
4. It is not currently possible to specify into which enumerated SCM instances repositories should be applied. As such, and for backwards compatibility, they will only be applied into the first instance of each of the insecure and secure docker GIT SCMs.
295
+
* Initialized and mirror repositories will be applied to both the insecure and secure GIT SCMs, if both are instantiated.
296
+
3. At most 10 insecure and 10 secure GIT SCMs are supported using the embedded docker compose.
297
+
4. It is not currently possible to specify into which enumerated SCM instances repositories should be applied. As such, and for backwards compatibility, they will only be applied into the first instance of each of the insecure and secure GIT SCMs.
0 commit comments