Merge "Add tests for barbican modules and states"
diff --git a/runtest/salttest/modules/openstack/barbican.sls b/runtest/salttest/modules/openstack/barbican.sls
new file mode 100644
index 0000000..4d9ebd6
--- /dev/null
+++ b/runtest/salttest/modules/openstack/barbican.sls
@@ -0,0 +1,110 @@
+{%- set secret_name = 'salttest_secret' %}
+{%- set secret_payload = salt['hashutil.base64_b64encode']('My_SaltTest_Payload') %}
+barbicanv1_secret_create:
+ module.run:
+ - name: barbicanv1.secret_create
+ - kwargs:
+ name: {{ secret_name }}
+ secret_type: passphrase
+ cloud_name: admin_identity
+
+barbicanv1_secret_list:
+ module.run:
+ - name: barbicanv1.secret_list
+ - kwargs:
+ cloud_name: admin_identity
+ - require:
+ - barbicanv1_secret_create
+
+barbicanv1_secret_get_details:
+ module.run:
+ - name: barbicanv1.secret_get_details
+ - args:
+ - {{ secret_name }}
+ - kwargs:
+ cloud_name: admin_identity
+ - require:
+ - barbicanv1_secret_create
+
+barbicanv1_secret_payload_set:
+ module.run:
+ - name: barbicanv1.secret_payload_set
+ - args:
+ - {{ secret_name }}
+ - kwargs:
+ payload: {{ secret_payload }}
+ payload_content_type: application/octet-stream
+ payload_content_encoding: base64
+ cloud_name: admin_identity
+ - require:
+ - barbicanv1_secret_create
+
+barbicanv1_secret_payload_get:
+ module.run:
+ - name: barbicanv1.secret_payload_get
+ - args:
+ - {{ secret_name }}
+ - kwargs:
+ cloud_name: admin_identity
+ - require:
+ - barbicanv1_secret_payload_set
+
+barbicanv1_secret_acl_put:
+ module.run:
+ - name: barbicanv1.secret_acl_put
+ - args:
+ - {{ secret_name }}
+ - kwargs:
+ users:
+ - 27f9ecd3656c494cb563cc58072db213
+ - abd3aeb1ab7c441cb2fc80eccd916a4c
+ project-access: True
+ cloud_name: admin_identity
+ - require:
+ - barbicanv1_secret_payload_get
+
+barbicanv1_secret_acl_get:
+ module.run:
+ - name: barbicanv1.secret_acl_get
+ - args:
+ - {{ secret_name }}
+ - kwargs:
+ cloud_name: admin_identity
+ - require:
+ - barbicanv1_secret_acl_put
+
+barbicanv1_secret_acl_patch:
+ module.run:
+ - name: barbicanv1.secret_acl_patch
+ - args:
+ - {{ secret_name }}
+ - kwargs:
+ users:
+ - 27f9ecd3656c494cb563cc58072db213
+ project-access: False
+ cloud_name: admin_identity
+ - require:
+ - barbicanv1_secret_acl_get
+
+barbicanv1_secret_acl_delete:
+ module.run:
+ - name: barbicanv1.secret_acl_delete
+ - args:
+ - {{ secret_name }}
+ - kwargs:
+ users:
+ - 27f9ecd3656c494cb563cc58072db213
+ project-access: False
+ cloud_name: admin_identity
+ - require:
+ - barbicanv1_secret_acl_get
+
+barbicanv1_secret_delete:
+ module.run:
+ - name: barbicanv1.secret_delete
+ - args:
+ - {{ secret_name }}
+ - kwargs:
+ cloud_name: admin_identity
+ - require:
+ - barbicanv1_secret_acl_delete
diff --git a/runtest/salttest/states/openstack/barbican.sls b/runtest/salttest/states/openstack/barbican.sls
new file mode 100644
index 0000000..3728e24
--- /dev/null
+++ b/runtest/salttest/states/openstack/barbican.sls
@@ -0,0 +1,17 @@
+{%- set payload = salt['hashutil.base64_b64encode']('TEST_SECRET_CERT') %}
+barbican_secret_present:
+ barbicanv1.secret_present:
+ - cloud_name: admin_identity
+ - name: SaltTestSecret
+ - algorithm: RSA
+ - secret_type: certificate
+ - payload: {{ payload }}
+ - payload_content_type: application/octet-stream
+ - payload_content_encoding: base64
+
+barbican_secret_absent:
+ barbicanv1.secret_absent:
+ - cloud_name: admin_identity
+ - name: SaltTestSecret
+ - require:
+ - barbican_secret_present