cli2 3.3.24__tar.gz → 3.3.25__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cli2-3.3.24/cli2.egg-info → cli2-3.3.25}/PKG-INFO +1 -1
- {cli2-3.3.24 → cli2-3.3.25}/cli2/client.py +4 -5
- {cli2-3.3.24 → cli2-3.3.25}/cli2/group.py +2 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2/test_client.py +17 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2/test_group.py +6 -1
- {cli2-3.3.24 → cli2-3.3.25/cli2.egg-info}/PKG-INFO +1 -1
- {cli2-3.3.24 → cli2-3.3.25}/setup.py +1 -1
- {cli2-3.3.24 → cli2-3.3.25}/MANIFEST.in +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/README.rst +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/classifiers.txt +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2/__init__.py +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2/argument.py +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2/asyncio.py +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2/cli.py +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2/colors.py +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2/command.py +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2/configuration.py +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2/decorators.py +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2/display.py +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2/entry_point.py +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2/example_client.py +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2/example_client_complex.py +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2/example_nesting.py +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2/example_obj.py +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2/logging.py +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2/node.py +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2/overrides.py +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2/sphinx.py +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2/table.py +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2/test.py +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2/test_cli.py +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2/test_command.py +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2/test_configuration.py +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2/test_decorators.py +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2/test_display.py +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2/test_entry_point.py +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2/test_inject.py +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2/test_node.py +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2/test_table.py +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2.egg-info/SOURCES.txt +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2.egg-info/dependency_links.txt +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2.egg-info/entry_points.txt +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2.egg-info/requires.txt +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/cli2.egg-info/top_level.txt +0 -0
- {cli2-3.3.24 → cli2-3.3.25}/setup.cfg +0 -0
|
@@ -675,13 +675,12 @@ class ModelGroup(Group):
|
|
|
675
675
|
)
|
|
676
676
|
)
|
|
677
677
|
|
|
678
|
+
url_list_methods = ['find', 'get', 'delete', 'create']
|
|
678
679
|
if cls.url_list:
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
self.cmd(cls.delete)
|
|
682
|
-
self.cmd(cls.create)
|
|
680
|
+
for name in url_list_methods:
|
|
681
|
+
self.cmd(getattr(cls, name))
|
|
683
682
|
|
|
684
|
-
self.load_cls(cls, exclude=
|
|
683
|
+
self.load_cls(cls, exclude=url_list_methods)
|
|
685
684
|
|
|
686
685
|
|
|
687
686
|
class ModelMetaclass(type):
|
|
@@ -183,6 +183,8 @@ class Group(EntryPoint, dict):
|
|
|
183
183
|
"""
|
|
184
184
|
exclude = exclude or []
|
|
185
185
|
for name, method in cls.__dict__.items():
|
|
186
|
+
if name in exclude:
|
|
187
|
+
continue
|
|
186
188
|
wrapped_method = getattr(method, '__func__', None)
|
|
187
189
|
if hasattr(wrapped_method, 'cli2'):
|
|
188
190
|
self.cmd(wrapped_method)
|
|
@@ -52,6 +52,23 @@ async def test_client_cli(client_class, httpx_mock):
|
|
|
52
52
|
await client_class.cli['testmodel']['find'].async_call()
|
|
53
53
|
|
|
54
54
|
|
|
55
|
+
@pytest.mark.asyncio
|
|
56
|
+
async def test_client_cli_override(client_class, httpx_mock):
|
|
57
|
+
class Client(client_class):
|
|
58
|
+
def __init__(self, *args, **kwargs):
|
|
59
|
+
self.test = 'bar'
|
|
60
|
+
super().__init__(*args, **kwargs)
|
|
61
|
+
|
|
62
|
+
class TestModel(Client.Model):
|
|
63
|
+
url_list = '{client.test}/foo'
|
|
64
|
+
|
|
65
|
+
@classmethod
|
|
66
|
+
@cli2.cmd
|
|
67
|
+
async def find(cls, foo):
|
|
68
|
+
return cls.url_list
|
|
69
|
+
assert await Client.cli['testmodel']['find'].async_call('bar') == 'bar/foo'
|
|
70
|
+
|
|
71
|
+
|
|
55
72
|
def test_client_model(client_class):
|
|
56
73
|
assert issubclass(client_class.Model, cli2.Model)
|
|
57
74
|
assert client_class.Model._client_class == client_class
|
|
@@ -224,8 +224,13 @@ def test_load_cls():
|
|
|
224
224
|
@cli2.cmd
|
|
225
225
|
def test2(self):
|
|
226
226
|
pass
|
|
227
|
+
|
|
228
|
+
@cli2.cmd
|
|
229
|
+
def exclude(self):
|
|
230
|
+
pass
|
|
227
231
|
group = Group()
|
|
228
|
-
group.load_cls(Foo)
|
|
232
|
+
group.load_cls(Foo, exclude=['exclude'])
|
|
229
233
|
assert 'bar' not in group
|
|
230
234
|
assert 'test' in group
|
|
231
235
|
assert 'test2' in group
|
|
236
|
+
assert 'exclude' not in group
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|