def test_config(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.get_config('0', 'state', _BASE_URL, project_id,
                                         cloud_region, registry_id, device_id,
                                         jwt_token).text)

    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 '"version": "1"' in out
def test_config(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.get_config(
            '0', 'state', _BASE_URL, project_id, cloud_region,
            registry_id, device_id, jwt_token).text)

    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 '"version": "1"' in out