Skip to content

Commit cdf5be7

Browse files
committed
Add a test for pulp_content_guard role
1 parent 1214cda commit cdf5be7

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed

tests/files/ca.pem

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIIEuTCCA6GgAwIBAgIQQBrEZCGzEyEDDrvkEhrFHTANBgkqhkiG9w0BAQsFADCB
3+
vTELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQL
4+
ExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwOCBWZXJp
5+
U2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MTgwNgYDVQQDEy9W
6+
ZXJpU2lnbiBVbml2ZXJzYWwgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAe
7+
Fw0wODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIG9MQswCQYDVQQGEwJVUzEX
8+
MBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0
9+
IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9y
10+
IGF1dGhvcml6ZWQgdXNlIG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNh
11+
bCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEF
12+
AAOCAQ8AMIIBCgKCAQEAx2E3XrEBNNti1xWb/1hajCMj1mCOkdeQmIN65lgZOIzF
13+
9uVkhbSicfvtvbnazU0AtMgtc6XHaXGVHzk8skQHnOgO+k1KxCHfKWGPMiJhgsWH
14+
H26MfF8WIFFE0XBPV+rjHOPMee5Y2A7Cs0WTwCznmhcrewA3ekEzeOEz4vMQGn+H
15+
LL729fdC4uW/h2KJXwBL38Xd5HVEMkE6HnFuacsLdUYI0crSK5XQz/u5QGtkjFdN
16+
/BMReYTtXlT2NJ8IAfMQJQYXStrxHXpma5hgZqTZ79IugvHw7wnqRMkVauIDbjPT
17+
rJ9VAMf2CGqUuV/c4DPxhGD5WycRtPwW8rtWaoAljQIDAQABo4GyMIGvMA8GA1Ud
18+
EwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMG0GCCsGAQUFBwEMBGEwX6FdoFsw
19+
WTBXMFUWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFI/l0xqGrI2Oa8PPgGrUSBgs
20+
exkuMCUWI2h0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMB0GA1Ud
21+
DgQWBBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG9w0BAQsFAAOCAQEASvj4
22+
sAPmLGd75JR3Y8xuTPl9Dg3cyLk1uXBPY/ok+myDjEedO2Pzmvl2MpWRsXe8rJq+
23+
seQxIcaBlVZaDrHC1LGmWazxY8u4TB1ZkErvkBYoH1quEPuBUDgMbMzxPcP1Y+Oz
24+
4yHJJDnp/RVmRvQbEdBNc6N9Rvk97ahfYtTxP/jgdFcrGJ2BtMQo2pSXpXDrrB2+
25+
BxHw1dvd5Yzw1TKwg+ZX4o+/vqGqvz0dtdQ46tewXDpPaj+PwGZsY6rp2aQW9IHR
26+
lRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4mJO3
27+
7M2CYfE45k+XmCpajQ==
28+
-----END CERTIFICATE-----

tests/test_content_guard.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
- name: Test content guards
3+
gather_facts: false
4+
hosts: localhost
5+
vars:
6+
pulp_url: http://localhost:8080
7+
pulp_username: admin
8+
pulp_password: password
9+
pulp_validate_certs: true
10+
tasks:
11+
- include_role:
12+
name: pulp_content_guard
13+
vars:
14+
pulp_content_guard_x509_cert_guards:
15+
- name: test_cert_guard
16+
description: foo
17+
ca_certificate: "{{ lookup('file', 'files/ca.pem') }}"
18+
state: present
19+
20+
- name: Query content guard
21+
pulp.squeezer.x509_cert_guard:
22+
pulp_url: "{{ pulp_url }}"
23+
username: "{{ pulp_username }}"
24+
password: "{{ pulp_password }}"
25+
validate_certs: "{{ pulp_validate_certs }}"
26+
name: test_cert_guard
27+
register: cg_result
28+
29+
- name: Verify cert guard creation
30+
assert:
31+
that:
32+
- cg_result.content_guard.name == "test_cert_guard"
33+
- cg_result.content_guard.description == "foo"
34+
- cg_result.content_guard.ca_certificate == lookup('file', 'files/ca.pem')
35+
36+
- include_role:
37+
name: pulp_content_guard
38+
vars:
39+
pulp_content_guard_x509_cert_guards:
40+
- name: test_cert_guard
41+
state: absent
42+
43+
- name: Query content guards
44+
pulp.squeezer.x509_cert_guard:
45+
pulp_url: "{{ pulp_url }}"
46+
username: "{{ pulp_username }}"
47+
password: "{{ pulp_password }}"
48+
validate_certs: "{{ pulp_validate_certs }}"
49+
register: cert_guards
50+
51+
- name: Verify cert guard deletion
52+
assert:
53+
that: cert_guards.content_guards | length == 0

0 commit comments

Comments
 (0)