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