Skip to content

Commit 40e7032

Browse files
committed
Add a bit more documentation
1 parent 867a913 commit 40e7032

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

src/python_testing/test_testing/test_TC_CCNTL_2_2.py

+23-2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141

4242

4343
def dynamic_invoke_return(*args, **argv):
44+
''' Returns the response to a mocked SendCommand call.
45+
'''
4446
global invoke_call_count
4547
invoke_call_count += 1
4648

@@ -79,6 +81,8 @@ def dynamic_invoke_return(*args, **argv):
7981

8082

8183
def dynamic_event_return(*args, **argv):
84+
''' Returns the response to a mocked ReadEvent call.
85+
'''
8286
global event_call_count
8387
event_call_count += 1
8488

@@ -105,6 +109,12 @@ def dynamic_event_return(*args, **argv):
105109

106110

107111
def wildcard() -> Attribute.AsyncReadTransaction.ReadResponse:
112+
''' Returns the response to a wildcard read.
113+
For this test, we just need descriptors and a few attributes
114+
Tree
115+
EP1 (Aggregator): Descriptor
116+
- EP2 (Bridged Node): Descriptor, Bridged Device Basic Information, Ecosystem Information
117+
'''
108118
cc = Clusters.CommissionerControl
109119
ei = Clusters.EcosystemInformation
110120
desc = Clusters.Descriptor
@@ -134,9 +144,20 @@ def wildcard() -> Attribute.AsyncReadTransaction.ReadResponse:
134144

135145

136146
class MyMock(MockTestRunner):
137-
# TODO consolidate with above
138147
def run_test_with_mock(self, dynamic_invoke_return: typing.Callable, dynamic_event_return: typing.Callable, read_cache: Attribute.AsyncReadTransaction.ReadResponse, hooks=None):
139-
''' Effects is a list of callable functions with *args, **kwargs parameters. It can either throw an InteractionModelException or return the command response.'''
148+
''' Run the test using the Mocked versions of Read, SendCommand, OpenCommissioningWindow, FindOrEstablishPASESession and ReadEvent
149+
dynamic_invoke_return: Callable function that returns the result of a SendCommand call
150+
Function should return one of
151+
- command response for commands with responses
152+
- None for commands with success results
153+
- raise InteractionModelError for error results
154+
dynamic_event_return: Callable function that returns the result of a ReadEvent call
155+
Function should return one of
156+
- list of EventReadResult for successful reads
157+
- raise InteractionModelError for error results
158+
read_cache : Response to a Read call. For this test, this will be the wildcard read of all teh attributes
159+
hooks : Test harness hook object if desired.
160+
'''
140161
self.default_controller.Read = AsyncMock(return_value=read_cache)
141162
self.default_controller.SendCommand = AsyncMock(return_value=None, side_effect=dynamic_invoke_return)
142163
# It doesn't actually matter what we return here because I'm going to catch the next pase session connection anyway

0 commit comments

Comments
 (0)