Merge "Add tests for glance modules and states"
diff --git a/runtest/salttest/modules/openstack/glancev2.sls b/runtest/salttest/modules/openstack/glancev2.sls
new file mode 100644
index 0000000..3a53605
--- /dev/null
+++ b/runtest/salttest/modules/openstack/glancev2.sls
@@ -0,0 +1,57 @@
+{%- set image_name = 'TestImage' %}
+{%- set image_properties = "[{'op':'add', 'path':'/test_property', 'value': 'test'},]" %}
+glancev2_image_create:
+  module.run:
+    - name: glancev2.image_create
+    - kwargs:
+        container_format: bare
+        disk_format: qcow2
+        name: {{ image_name }}
+        cloud_name: admin_identity
+
+glancev2_image_list:
+  module.run:
+    - name: glancev2.image_list
+    - kwargs:
+        cloud_name: admin_identity
+    - require:
+      - glancev2_image_create
+
+glancev2_image_get_details:
+  module.run:
+    - name: glancev2.image_get_details
+    - args:
+      - {{ image_name }}
+    - kwargs:
+        cloud_name: admin_identity
+    - require:
+      - glancev2_image_list
+
+glancev2_image_update:
+  module.run:
+    - name: glancev2.image_update
+    - args:
+      - {{ image_name }}
+      - {{ image_properties }}
+    - kwargs:
+        cloud_name: admin_identity
+    - require:
+      - glancev2_image_get_details
+
+glancev2_image_delete:
+  module.run:
+    - name: glancev2.image_delete
+    - args:
+      - {{ image_name }}
+    - kwargs:
+        cloud_name: admin_identity
+    - require:
+      - glancev2_image_update
+
+glancev2_task_list:
+  module.run:
+    - name: glancev2.task_list
+    - kwargs:
+        cloud_name: admin_identity
+    - require:
+      - glancev2_image_delete
diff --git a/runtest/salttest/modules/openstack/init.sls b/runtest/salttest/modules/openstack/init.sls
index 9e591a9..f2e0c47 100644
--- a/runtest/salttest/modules/openstack/init.sls
+++ b/runtest/salttest/modules/openstack/init.sls
@@ -1,5 +1,6 @@
 include:
 - runtest.salttest.modules.openstack.glance
+- runtest.salttest.modules.openstack.glancev2
 - runtest.salttest.modules.openstack.keystone
 - runtest.salttest.modules.openstack.nova
 - runtest.salttest.modules.openstack.neutron
diff --git a/runtest/salttest/states/openstack/glancev2.sls b/runtest/salttest/states/openstack/glancev2.sls
new file mode 100644
index 0000000..cfe8c99
--- /dev/null
+++ b/runtest/salttest/states/openstack/glancev2.sls
@@ -0,0 +1,15 @@
+{%- set glance_location = 'https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img' %}
+{%- set glance_properties = '{"container_format": "bare", "disk_format": "raw", "protected": false, "tags": ["tags1", "tags2"], "visibility": "public"}' %}
+glance_image_present:
+  glancev2.image_present:
+  - cloud_name: admin_identity
+  - name: TestImage
+  - location: {{ glance_location }}
+  - image_properties: {{ glance_properties }}
+
+glance_image_absent:
+  glancev2.image_absent:
+  - cloud_name: admin_identity
+  - name: TestImage
+  - require:
+    - glance_image_present
diff --git a/runtest/salttest/states/openstack/init.sls b/runtest/salttest/states/openstack/init.sls
index 2202afe..6a26911 100644
--- a/runtest/salttest/states/openstack/init.sls
+++ b/runtest/salttest/states/openstack/init.sls
@@ -1,3 +1,4 @@
 include:
 - runtest.salttest.states.openstack.neutron
 - runtest.salttest.states.openstack.nova
+- runtest.salttest.states.openstack.glancev2