# TODO: Until we have a module to create/delete images this is the best tests I can do
- name: Assert error thrown with invalid image dict
  azure_rm_virtualmachine:
    resource_group: "{{ resource_group }}"
    name: "{{ vm_name }}"
    image:
      offer: UbuntuServer
  register: fail_invalid_image_dict
  failed_when: 'fail_invalid_image_dict.msg != "parameter error: expecting image to contain [publisher, offer, sku, version], [name, resource_group] or [id]"'

- name: Assert error thrown with invalid image type
  azure_rm_virtualmachine:
    resource_group: "{{ resource_group }}"
    name: "{{ vm_name }}"
    image:
      - testing
  register: fail_invalid_image_type
  failed_when: 'fail_invalid_image_type.msg != "parameter error: expecting image to be a string or dict not list"'

- name: Assert error finding missing custom image
  azure_rm_virtualmachine:
    resource_group: "{{ resource_group }}"
    name: "{{ vm_name }}"
    image: invalid-image
  register: fail_missing_custom_image
  failed_when: fail_missing_custom_image.msg != "Error could not find image with name invalid-image"

- name: Assert error finding missing custom image (dict style)
  azure_rm_virtualmachine:
    resource_group: "{{ resource_group }}"
    name: "{{ vm_name }}"
    image:
      name: invalid-image
  register: fail_missing_custom_image_dict
  failed_when: fail_missing_custom_image_dict.msg != "Error could not find image with name invalid-image"
