def test_state(test_topic, capsys): device_id = device_id_template.format('RSA256') manager.open_registry(service_account_json, project_id, cloud_region, pubsub_topic, registry_id) manager.create_rs256_device(service_account_json, project_id, cloud_region, registry_id, device_id, rsa_cert_path) manager.get_device(service_account_json, project_id, cloud_region, registry_id, device_id) jwt_token = cloudiot_http_example.create_jwt(project_id, 'resources/rsa_private.pem', 'RS256') print( cloudiot_http_example.publish_message('hello', 'state', _BASE_URL, project_id, cloud_region, registry_id, device_id, jwt_token)) manager.get_state(service_account_json, project_id, cloud_region, registry_id, device_id) manager.delete_device(service_account_json, project_id, cloud_region, registry_id, device_id) manager.delete_registry(service_account_json, project_id, cloud_region, registry_id) out, _ = capsys.readouterr() assert 'format : RSA_X509_PEM' in out assert 'State: {' in out assert 'aGVsbG8=' in out assert '200' in out
def test_state(test_topic, capsys): device_id = device_id_template.format("RSA256") manager.open_registry( service_account_json, project_id, cloud_region, pubsub_topic, registry_id ) manager.create_rs256_device( service_account_json, project_id, cloud_region, registry_id, device_id, rsa_cert_path, ) manager.get_device( service_account_json, project_id, cloud_region, registry_id, device_id ) jwt_token = cloudiot_http_example.create_jwt( project_id, "resources/rsa_private.pem", "RS256" ) print( cloudiot_http_example.publish_message( "hello", "state", _BASE_URL, project_id, cloud_region, registry_id, device_id, jwt_token, ) ) manager.get_state( service_account_json, project_id, cloud_region, registry_id, device_id ) manager.delete_device( service_account_json, project_id, cloud_region, registry_id, device_id ) manager.delete_registry(service_account_json, project_id, cloud_region, registry_id) out, _ = capsys.readouterr() assert "format : RSA_X509_PEM" in out assert 'binary_data: "hello"' in out assert "200" in out
def test_state(test_topic, capsys): device_id = device_id_template.format('RSA256') manager.open_registry( service_account_json, project_id, cloud_region, pubsub_topic, registry_id) manager.create_rs256_device( service_account_json, project_id, cloud_region, registry_id, device_id, rsa_cert_path) manager.get_device( service_account_json, project_id, cloud_region, registry_id, device_id) jwt_token = cloudiot_http_example.create_jwt( project_id, 'resources/rsa_private.pem', 'RS256') print(cloudiot_http_example.publish_message( 'hello', 'state', _BASE_URL, project_id, cloud_region, registry_id, device_id, jwt_token)) manager.get_state( service_account_json, project_id, cloud_region, registry_id, device_id) manager.delete_device( service_account_json, project_id, cloud_region, registry_id, device_id) manager.delete_registry( service_account_json, project_id, cloud_region, registry_id) out, _ = capsys.readouterr() assert 'format : RSA_X509_PEM' in out assert 'State: {' in out assert 'aGVsbG8=' in out assert '200' in out