File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44from 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+
1618class 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+
3245class 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
Original file line number Diff line number Diff line change 11import pytest
22from polywrap_core import Uri , Env
33from polywrap_ccb import ClientConfig , ClientConfigBuilder
4+ from dataclasses import asdict
45
56def 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
1213def 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 ) )
Original file line number Diff line number Diff line change 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" : {
You can’t perform that action at this time.
0 commit comments