<commit_before>---
- name: Check for required variables
  assert:
    that:
      - resource_prefix is defined and resource_prefix
      - rackspace_username is defined and rackspace_username
      - rackspace_api_key is defined and rackspace_api_key
      - rackspace_region is defined and rackspace_region

# ============================================================
- name: Test rax_clb with no args
  rax_clb:
  ignore_errors: true
  register: rax_clb

- name: Validate results of rax_clb with no args
  assert:
    that:
      - rax_clb|failed
      - rax_clb.msg == 'No credentials supplied!'
# ============================================================



# ============================================================
- name: Test rax_clb with credentials
  rax_clb:
    username: "{{ rackspace_username }}"
    api_key: "{{ rackspace_api_key }}"
  ignore_errors: true
  register: rax_clb

- name: Validate results of rax_clb with only creds
  assert:
    that:
      - rax_clb|failed
      - rax_clb.msg.startswith('None is not a valid region')
# ============================================================



# ============================================================
- name: Test rax_clb with creds and region
  rax_clb:
    username: "{{ rackspace_username }}"
    api_key: "{{ rackspace_api_key }}"
    region: "{{ rackspace_region }}"
  ignore_errors: true
  register: rax_clb

## This assertion is currently failing, due to the module not providing the correct name of the missing argument
- name: Validate rax_clb creds and region
  assert:
    that:
      - rax_clb|failed
      - rax_clb.msg == 'name is required for rax_clb'
  ignore_errors: true
# ============================================================



# ============================================================
- name: Test rax_clb with creds, region and name
  rax_clb:
    username: "{{ rackspace_username }}"
    api_key: "{{ rackspace_api_key }}"
    region: "{{ rackspace_region }}"
    name: "{{ resource_prefix }}-1"
    wait: true
  register: rax_clb<commit_msg>Update rax_clb tests for fixes in the module<commit_after>---
- name: Check for required variables
  assert:
    that:
      - resource_prefix is defined and resource_prefix
      - rackspace_username is defined and rackspace_username
      - rackspace_api_key is defined and rackspace_api_key
      - rackspace_region is defined and rackspace_region

# ============================================================
- name: Test rax_clb with no args
  rax_clb:
  ignore_errors: true
  register: rax_clb

- name: Validate results of rax_clb with no args
  assert:
    that:
      - rax_clb|failed
      - rax_clb.msg == 'missing required arguments: name'
# ============================================================



# ============================================================
- name: Test rax_clb with name
  rax_clb:
    name: fail
  ignore_errors: true
  register: rax_clb

- name: Validate results of rax_clb with only creds
  assert:
    that:
      - rax_clb|failed
      - rax_clb.msg == 'No credentials supplied!'
# ============================================================



# ============================================================
- name: Test rax_clb with name and credentials
  rax_clb:
    username: "{{ rackspace_username }}"
    api_key: "{{ rackspace_api_key }}"
    name: fail
  ignore_errors: true
  register: rax_clb

- name: Validate results of rax_clb with only creds
  assert:
    that:
      - rax_clb|failed
      - rax_clb.msg.startswith('None is not a valid region')
# ============================================================



# ============================================================
- name: Test rax_clb with creds and region
  rax_clb:
    username: "{{ rackspace_username }}"
    api_key: "{{ rackspace_api_key }}"
    region: "{{ rackspace_region }}"
  ignore_errors: true
  register: rax_clb

- name: Validate rax_clb creds and region
  assert:
    that:
      - rax_clb|failed
      - rax_clb.msg == 'missing required arguments: name'
# ============================================================



# ============================================================
- name: Test rax_clb with creds, region and name
  rax_clb:
    username: "{{ rackspace_username }}"
    api_key: "{{ rackspace_api_key }}"
    region: "{{ rackspace_region }}"
    name: "{{ resource_prefix }}-1"
    wait: true
  register: rax_clb
{'fraction_non_alphanumeric': 0.28755074424898514, 'fraction_numerical': 0.0004510599909788002, 'mean_word_length': 4.145011600928075, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1455449', 'n_tokens_mistral': 1324, 'n_tokens_neox': 1257, 'n_words': 337}