summaryrefslogtreecommitdiff
path: root/test/integration/targets/tower_project/tasks/main.yml
blob: ba9096c20f41567f440ad534940d3d0a6eba91d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
- name: Create an SCM Credential
  tower_credential:
    name: SCM Credential for Project
    organization: Default
    kind: scm

- name: Create a Project
  tower_project:
    name: my-project
    organization: Default
    state: present
    scm_credential: SCM Credential for Project
  register: result

- assert:
    that:
      - "result is changed"

- name: Delete a Project
  tower_project:
    name: my-project
    state: absent
  register: result

- assert:
    that:
      - "result is changed"

- name: create a project directory for manual project
  import_tasks: create_project_dir.yml

- name: Create a manual project
  tower_project:
    name: manual project
    organization: Default
    scm_type: manual
    local_path: "manual_test_project"
  register: result

- assert:
    that:
      - "result is changed"

- name: Create a git project without credentials
  tower_project:
    name: git project
    organization: Default
    scm_type: git
    scm_url: https://github.com/ansible/ansible

- name: "Create {{ item }}"
  tower_organization:
    name: "{{ item }}"
  loop:
    - TestOrg1
    - TestOrg2

- name: "Create credential"
  tower_credential:
    kind: scm
    name: TestCred1
    organization: "{{ item }}"
  loop:
    - TestOrg2
    - TestOrg1

- name: Create project TestProject
  tower_project:
    name: TestProject
    organization: TestOrg1
    scm_type: git
    scm_url: "https://github.com/ansible/ansible"
    scm_credential: TestCred1
  register: multi_org_cred_project

- assert:
    that:
      - "multi_org_cred_project is changed"

- name: Check module fails with correct msg
  tower_project:
    name: TestProject
    organization: Non Existing Org
    scm_type: git
    scm_url: "https://github.com/ansible/ansible"
    scm_credential: TestCred1
  register: result
  ignore_errors: true

- assert:
    that:
      - "result.msg == 'Failed to update project, organization not found: Non Existing Org'"

- name: Check module fails with correct msg
  tower_project:
    name: TestProject
    organization: TestOrg1
    scm_type: git
    scm_url: "https://github.com/ansible/ansible"
    scm_credential: Non Existing Credential
  register: result
  ignore_errors: true

- assert:
    that:
      - "result.msg =='Failed to update project, credential not found: Non Existing Credential'"