示例#1
0
def test_add_patch_delete_es256(test_topic, capsys):
    device_id = device_id_template.format('PATCHME')
    manager.open_registry(service_account_json, project_id, cloud_region,
                          pubsub_topic, registry_id)

    manager.create_es256_device(service_account_json, project_id, cloud_region,
                                registry_id, device_id, es_cert_path)

    manager.get_device(service_account_json, project_id, cloud_region,
                       registry_id, device_id)
    out, _ = capsys.readouterr()
    assert 'format : ES256_PEM' in out

    manager.patch_rsa256_auth(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)
    out, _ = capsys.readouterr()
    assert 'format : RSA_X509_PEM' in out

    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)
def test_add_patch_delete_es256(test_topic, capsys):
    device_id = device_id_template.format('PATCHME')
    manager.open_registry(
            service_account_json, project_id, cloud_region, pubsub_topic,
            registry_id)

    manager.create_es256_device(
            service_account_json, project_id, cloud_region, registry_id,
            device_id, es_cert_path)

    manager.get_device(
            service_account_json, project_id, cloud_region, registry_id,
            device_id)
    out, _ = capsys.readouterr()
    assert 'format : ES256_PEM' in out

    manager.patch_rsa256_auth(
            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)
    out, _ = capsys.readouterr()
    assert 'format : RSA_X509_PEM' in out

    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)