1 # Copyright (c) 2021 Project CHIP Authors
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 from chip_mobly import pigweed_device
16 from mobly import asserts
17 from mobly import base_test
18 from mobly import test_runner
22 class PigweedEchoTest(base_test.BaseTestClass):
23 def setup_class(self):
24 ''' Registering pigweed_device controller module declares the test's
25 dependency on CHIP/Pigweed device hardware. By default, we expect at least one
26 object is created from this.'''
27 self.ads = self.register_controller(pigweed_device)
28 self.dut = self.ads[0]
29 self.dut.platform.flash() # Flashes the image passed in the configuration yml.
30 time.sleep(1) # give the device time to boot and register rpcs
33 ''' Tests EchoService.Echo '''
35 status, payload = self.dut.rpcs().EchoService.Echo(msg=expected)
36 asserts.assert_true(status.ok(), "Status is %s" % status)
40 'Returned payload is "%s" expected "%s"' % (payload.msg, expected),
44 if __name__ == "__main__":