mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-21 17:16:46 +03:00
Fix code layout in tests/unit/schema/test_integration_py36.py
This commit is contained in:
parent
142b91921a
commit
0668295543
|
@ -17,6 +17,7 @@ Development
|
||||||
Thanks to `@illia-v (Illia Volochii) <https://github.com/illia-v>`_ for the
|
Thanks to `@illia-v (Illia Volochii) <https://github.com/illia-v>`_ for the
|
||||||
PR (`#580 <https://github.com/ets-labs/python-dependency-injector/pull/580>`_).
|
PR (`#580 <https://github.com/ets-labs/python-dependency-injector/pull/580>`_).
|
||||||
- Update copyright year.
|
- Update copyright year.
|
||||||
|
- Enable skipped test ``test_schema_with_boto3_session()``.
|
||||||
- Update pytest configuration.
|
- Update pytest configuration.
|
||||||
- Regenerate C sources using Cython 0.29.30.
|
- Regenerate C sources using Cython 0.29.30.
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ import os
|
||||||
import sqlite3
|
import sqlite3
|
||||||
|
|
||||||
from dependency_injector import containers
|
from dependency_injector import containers
|
||||||
from pytest import mark
|
|
||||||
|
|
||||||
from samples.schema.services import UserService, AuthService, PhotoService
|
from samples.schema.services import UserService, AuthService, PhotoService
|
||||||
|
|
||||||
|
@ -19,18 +18,20 @@ SAMPLES_DIR = os.path.abspath(
|
||||||
|
|
||||||
def test_single_container_schema(container: containers.DynamicContainer):
|
def test_single_container_schema(container: containers.DynamicContainer):
|
||||||
container.from_yaml_schema(f"{SAMPLES_DIR}/schema/container-single.yml")
|
container.from_yaml_schema(f"{SAMPLES_DIR}/schema/container-single.yml")
|
||||||
container.config.from_dict({
|
container.config.from_dict(
|
||||||
"database": {
|
{
|
||||||
"dsn": ":memory:",
|
"database": {
|
||||||
},
|
"dsn": ":memory:",
|
||||||
"aws": {
|
},
|
||||||
"access_key_id": "KEY",
|
"aws": {
|
||||||
"secret_access_key": "SECRET",
|
"access_key_id": "KEY",
|
||||||
},
|
"secret_access_key": "SECRET",
|
||||||
"auth": {
|
},
|
||||||
"token_ttl": 3600,
|
"auth": {
|
||||||
},
|
"token_ttl": 3600,
|
||||||
})
|
},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
# User service
|
# User service
|
||||||
user_service1 = container.user_service()
|
user_service1 = container.user_service()
|
||||||
|
@ -79,18 +80,20 @@ def test_single_container_schema(container: containers.DynamicContainer):
|
||||||
|
|
||||||
def test_multiple_containers_schema(container: containers.DynamicContainer):
|
def test_multiple_containers_schema(container: containers.DynamicContainer):
|
||||||
container.from_yaml_schema(f"{SAMPLES_DIR}/schema/container-multiple.yml")
|
container.from_yaml_schema(f"{SAMPLES_DIR}/schema/container-multiple.yml")
|
||||||
container.core.config.from_dict({
|
container.core.config.from_dict(
|
||||||
"database": {
|
{
|
||||||
"dsn": ":memory:",
|
"database": {
|
||||||
|
"dsn": ":memory:",
|
||||||
|
},
|
||||||
|
"aws": {
|
||||||
|
"access_key_id": "KEY",
|
||||||
|
"secret_access_key": "SECRET",
|
||||||
|
},
|
||||||
|
"auth": {
|
||||||
|
"token_ttl": 3600,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"aws": {
|
)
|
||||||
"access_key_id": "KEY",
|
|
||||||
"secret_access_key": "SECRET",
|
|
||||||
},
|
|
||||||
"auth": {
|
|
||||||
"token_ttl": 3600,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
# User service
|
# User service
|
||||||
user_service1 = container.services.user()
|
user_service1 = container.services.user()
|
||||||
|
@ -139,18 +142,20 @@ def test_multiple_containers_schema(container: containers.DynamicContainer):
|
||||||
|
|
||||||
def test_multiple_reordered_containers_schema(container: containers.DynamicContainer):
|
def test_multiple_reordered_containers_schema(container: containers.DynamicContainer):
|
||||||
container.from_yaml_schema(f"{SAMPLES_DIR}/schema/container-multiple-reordered.yml")
|
container.from_yaml_schema(f"{SAMPLES_DIR}/schema/container-multiple-reordered.yml")
|
||||||
container.core.config.from_dict({
|
container.core.config.from_dict(
|
||||||
"database": {
|
{
|
||||||
"dsn": ":memory:",
|
"database": {
|
||||||
|
"dsn": ":memory:",
|
||||||
|
},
|
||||||
|
"aws": {
|
||||||
|
"access_key_id": "KEY",
|
||||||
|
"secret_access_key": "SECRET",
|
||||||
|
},
|
||||||
|
"auth": {
|
||||||
|
"token_ttl": 3600,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"aws": {
|
)
|
||||||
"access_key_id": "KEY",
|
|
||||||
"secret_access_key": "SECRET",
|
|
||||||
},
|
|
||||||
"auth": {
|
|
||||||
"token_ttl": 3600,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
# User service
|
# User service
|
||||||
user_service1 = container.services.user()
|
user_service1 = container.services.user()
|
||||||
|
@ -199,18 +204,20 @@ def test_multiple_reordered_containers_schema(container: containers.DynamicConta
|
||||||
|
|
||||||
def test_multiple_containers_with_inline_providers_schema(container: containers.DynamicContainer):
|
def test_multiple_containers_with_inline_providers_schema(container: containers.DynamicContainer):
|
||||||
container.from_yaml_schema(f"{SAMPLES_DIR}/schema/container-multiple-inline.yml")
|
container.from_yaml_schema(f"{SAMPLES_DIR}/schema/container-multiple-inline.yml")
|
||||||
container.core.config.from_dict({
|
container.core.config.from_dict(
|
||||||
"database": {
|
{
|
||||||
"dsn": ":memory:",
|
"database": {
|
||||||
|
"dsn": ":memory:",
|
||||||
|
},
|
||||||
|
"aws": {
|
||||||
|
"access_key_id": "KEY",
|
||||||
|
"secret_access_key": "SECRET",
|
||||||
|
},
|
||||||
|
"auth": {
|
||||||
|
"token_ttl": 3600,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"aws": {
|
)
|
||||||
"access_key_id": "KEY",
|
|
||||||
"secret_access_key": "SECRET",
|
|
||||||
},
|
|
||||||
"auth": {
|
|
||||||
"token_ttl": 3600,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
# User service
|
# User service
|
||||||
user_service1 = container.services.user()
|
user_service1 = container.services.user()
|
||||||
|
@ -257,7 +264,6 @@ def test_multiple_containers_with_inline_providers_schema(container: containers.
|
||||||
assert photo_service2.s3 is container.gateways.s3_client()
|
assert photo_service2.s3 is container.gateways.s3_client()
|
||||||
|
|
||||||
|
|
||||||
@mark.skip(reason="Boto3 tries to connect to the internet")
|
|
||||||
def test_schema_with_boto3_session(container: containers.DynamicContainer):
|
def test_schema_with_boto3_session(container: containers.DynamicContainer):
|
||||||
container.from_yaml_schema(f"{SAMPLES_DIR}/schema/container-boto3-session.yml")
|
container.from_yaml_schema(f"{SAMPLES_DIR}/schema/container-boto3-session.yml")
|
||||||
container.config.from_dict(
|
container.config.from_dict(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user