Skip to content

Commit f3df141

Browse files
committed
set up config and fix tests
1 parent 5e03597 commit f3df141

3 files changed

Lines changed: 23 additions & 13 deletions

File tree

packages/polywrap-ccb/polywrap_ccb/ccb.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from typing import Dict, Any, List
55

66
@dataclass(slots=True, kw_only=True)
7-
class ClientConfig:
7+
class ClientConfig():
88
"""
99
This Abstract class is used to configure the polywrap client before it executes a call
1010
The ClientConfig class is created and modified with the ClientConfigBuilder module
@@ -13,27 +13,39 @@ class ClientConfig:
1313
interfaces: Dict[Uri, List[Uri]]
1414
resolver: IUriResolver
1515

16+
#
17+
1618
class IClientConfigBuilder(ABC):
17-
@staticmethod
19+
20+
@abstractmethod
1821
def build() -> ClientConfig:
1922
"""Returns a sanitized config object from the builder's config."""
2023
pass
2124

2225
@abstractmethod
2326
def set_env() -> ClientConfig:
24-
"""Returns a sanitized config object from the builder's config."""
2527
pass
2628

2729
@abstractmethod
28-
def set_env() -> ClientConfig:
29-
"""Returns a sanitized config object from the builder's config."""
30+
def add_env() -> ClientConfig:
3031
pass
3132

33+
@abstractmethod
34+
def add_envs() -> ClientConfig:
35+
pass
36+
37+
# @abstractmethod
38+
# def add_interface() -> ClientConfig:
39+
# pass
40+
41+
# @abstractmethod
42+
# def set_resolver() -> ClientConfig:
43+
# pass
44+
3245
class BaseClientConfigBuilder(IClientConfigBuilder):
3346
"""A concrete class of the Client Config Builder, which uses the IClientConfigBuilder Abstract Base Class"""
3447
# config: ClientConfig
3548

36-
3749
def __init__(self):
3850
self.config = ClientConfig(envs={}, interfaces={}, resolver=None)
3951

packages/polywrap-ccb/tests/test_clientconfig.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import pytest
22
from polywrap_core import Uri, Env
33
from polywrap_ccb import ClientConfig, ClientConfigBuilder
4+
from dataclasses import asdict
45

56
def test_client_config_structure_starts_empty():
67
ccb = ClientConfigBuilder()
78
client_config = ccb.build()
89
result = ClientConfig(envs={}, interfaces={}, resolver = None)
9-
assert client_config == result
10+
assert asdict(client_config) == asdict(result)
1011

1112

1213
def test_client_config_structure_sets_env():
@@ -18,4 +19,4 @@ def test_client_config_structure_sets_env():
1819
env = env
1920
)
2021
client_config = ccb.build()
21-
assert client_config == ClientConfig(envs={uri: env}, interfaces={}, resolver = None)
22+
assert asdict(client_config) == asdict(ClientConfig(envs={uri: env}, interfaces={}, resolver = None))

python-monorepo.code-workspace

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,8 @@
3737
"path": "packages/polywrap-plugin"
3838
},
3939
{
40-
"name": "polywrap-client-config-builder",
41-
"path": "packages/polywrap-client-config-builder"
42-
},
43-
{
44-
"path": "../../../Desktop/polywrap-client-config-builder"
40+
"name": "polywrap-client-cbb",
41+
"path": "packages/polywrap-ccb"
4542
}
4643
],
4744
"settings": {

0 commit comments

Comments
 (0)