summaryrefslogtreecommitdiff
path: root/test/support
diff options
context:
space:
mode:
authorTiago Freire <tcfonnet@gmail.com>2016-08-16 01:18:30 -0300
committerTiago Freire <code.tiago.frire@locaweb.com.br>2016-08-18 15:08:05 -0300
commit1db1adbf2d061848f78711c38678edd02250f923 (patch)
tree2932151e492855506a40c9e7af5b6e7583aa1903 /test/support
parent[WIP] Init. (diff)
WIP
Diffstat (limited to 'test/support')
-rw-r--r--test/support/cassettes/records_manager/create/success.json30
-rw-r--r--test/support/cassettes/records_manager/update/success.json30
-rw-r--r--test/support/cassettes/zones_manager/create/invalid_not_canonical.json31
-rw-r--r--test/support/cassettes/zones_manager/create/success.json31
-rw-r--r--test/support/cassettes/zones_manager/create/valid_parameters.json1
-rw-r--r--test/support/cassettes/zones_manager/show/not_found.json31
-rw-r--r--test/support/cassettes/zones_manager/show/success.json31
-rw-r--r--test/support/cassettes/zones_manager/show/valid_record.json27
-rw-r--r--test/support/fake_config.exs9
9 files changed, 190 insertions, 31 deletions
diff --git a/test/support/cassettes/records_manager/create/success.json b/test/support/cassettes/records_manager/create/success.json
new file mode 100644
index 0000000..73bdc22
--- /dev/null
+++ b/test/support/cassettes/records_manager/create/success.json
@@ -0,0 +1,30 @@
+[
+ {
+ "request": {
+ "body": "{\"rrsets\":[{\"type\":\"A\",\"ttl\":86400,\"records\":[{\"disabled\":false,\"content\":\"127.0.0.1\"},{\"disabled\":true,\"content\":\"192.168.0.1\"}],\"name\":\"new-record.my-domain.art.\",\"changetype\":\"REPLACE\"}]}",
+ "headers": {
+ "X-API-Key": "Locaweb2016"
+ },
+ "method": "patch",
+ "options": [],
+ "request_body": "",
+ "url": "http://cpro36999.systemintegration.locaweb.com.br/api/v1/servers/localhost/zones/my-domain.art."
+ },
+ "response": {
+ "body": "",
+ "headers": {
+ "Access-Control-Allow-Origin": "*",
+ "Connection": "close",
+ "Content-Length": "0",
+ "Content-Security-Policy": "default-src 'self'; style-src 'self' 'unsafe-inline'",
+ "Server": "PowerDNS/4.0.1",
+ "X-Content-Type-Options": "nosniff",
+ "X-Frame-Options": "deny",
+ "X-Permitted-Cross-Domain-Policies": "none",
+ "X-Xss-Protection": "1; mode=block"
+ },
+ "status_code": 204,
+ "type": "ok"
+ }
+ }
+] \ No newline at end of file
diff --git a/test/support/cassettes/records_manager/update/success.json b/test/support/cassettes/records_manager/update/success.json
new file mode 100644
index 0000000..d6a5112
--- /dev/null
+++ b/test/support/cassettes/records_manager/update/success.json
@@ -0,0 +1,30 @@
+[
+ {
+ "request": {
+ "body": "{\"rrsets\":[{\"type\":\"A\",\"ttl\":86800,\"records\":[{\"disabled\":true,\"content\":\"127.0.0.1\"}],\"name\":\"updated-record.my-domain.art.\",\"changetype\":\"REPLACE\"}]}",
+ "headers": {
+ "X-API-Key": "Locaweb2016"
+ },
+ "method": "patch",
+ "options": [],
+ "request_body": "",
+ "url": "http://cpro36999.systemintegration.locaweb.com.br/api/v1/servers/localhost/zones/my-domain.art."
+ },
+ "response": {
+ "body": "",
+ "headers": {
+ "Access-Control-Allow-Origin": "*",
+ "Connection": "close",
+ "Content-Length": "0",
+ "Content-Security-Policy": "default-src 'self'; style-src 'self' 'unsafe-inline'",
+ "Server": "PowerDNS/4.0.1",
+ "X-Content-Type-Options": "nosniff",
+ "X-Frame-Options": "deny",
+ "X-Permitted-Cross-Domain-Policies": "none",
+ "X-Xss-Protection": "1; mode=block"
+ },
+ "status_code": 204,
+ "type": "ok"
+ }
+ }
+] \ No newline at end of file
diff --git a/test/support/cassettes/zones_manager/create/invalid_not_canonical.json b/test/support/cassettes/zones_manager/create/invalid_not_canonical.json
new file mode 100644
index 0000000..353115d
--- /dev/null
+++ b/test/support/cassettes/zones_manager/create/invalid_not_canonical.json
@@ -0,0 +1,31 @@
+[
+ {
+ "request": {
+ "body": "{\"soa_edit_api\":\"\",\"soa_edit\":\"\",\"serial\":2016060601,\"records\":[],\"nameservers\":[],\"name\":\"not-canonical-domain.tst\",\"masters\":[],\"kind\":\"Native\",\"account\":null}",
+ "headers": {
+ "X-API-Key": "Locaweb2016"
+ },
+ "method": "post",
+ "options": [],
+ "request_body": "",
+ "url": "http://cpro36999.systemintegration.locaweb.com.br/api/v1/servers/localhost/zones"
+ },
+ "response": {
+ "body": "{\"error\": \"DNS Name 'not-canonical-domain.tst' is not canonical\"}",
+ "headers": {
+ "Access-Control-Allow-Origin": "*",
+ "Connection": "close",
+ "Content-Length": "54",
+ "Content-Security-Policy": "default-src 'self'; style-src 'self' 'unsafe-inline'",
+ "Content-Type": "application/json",
+ "Server": "PowerDNS/4.0.1",
+ "X-Content-Type-Options": "nosniff",
+ "X-Frame-Options": "deny",
+ "X-Permitted-Cross-Domain-Policies": "none",
+ "X-Xss-Protection": "1; mode=block"
+ },
+ "status_code": 422,
+ "type": "ok"
+ }
+ }
+]
diff --git a/test/support/cassettes/zones_manager/create/success.json b/test/support/cassettes/zones_manager/create/success.json
new file mode 100644
index 0000000..e7880c8
--- /dev/null
+++ b/test/support/cassettes/zones_manager/create/success.json
@@ -0,0 +1,31 @@
+[
+ {
+ "request": {
+ "body": "{\"soa_edit_api\":\"\",\"soa_edit\":\"\",\"serial\":2016060601,\"records\":[],\"nameservers\":[],\"name\":\"my-domain.art.\",\"masters\":[],\"kind\":\"Native\",\"account\":null}",
+ "headers": {
+ "X-API-Key": "Locaweb2016"
+ },
+ "method": "post",
+ "options": [],
+ "request_body": "",
+ "url": "http://cpro36999.systemintegration.locaweb.com.br/api/v1/servers/localhost/zones"
+ },
+ "response": {
+ "body": "{\"account\": \"\", \"dnssec\": false, \"id\": \"my-domain.art.\", \"kind\": \"Native\", \"last_check\": 0, \"masters\": [], \"name\": \"my-domain.art.\", \"notified_serial\": 0, \"rrsets\": [{\"comments\": [], \"name\": \"my-domain.art.\", \"records\": [{\"content\": \"a.misconfigured.powerdns.server. hostmaster.my-domain.art. 2016060601 10800 3600 604800 3600\", \"disabled\": false}], \"ttl\": 3600, \"type\": \"SOA\"}], \"serial\": 2016060601, \"soa_edit\": \"\", \"soa_edit_api\": \"\", \"url\": \"api/v1/servers/localhost/zones/my-domain.art.\"}",
+ "headers": {
+ "Access-Control-Allow-Origin": "*",
+ "Connection": "close",
+ "Content-Length": "493",
+ "Content-Security-Policy": "default-src 'self'; style-src 'self' 'unsafe-inline'",
+ "Content-Type": "application/json",
+ "Server": "PowerDNS/4.0.1",
+ "X-Content-Type-Options": "nosniff",
+ "X-Frame-Options": "deny",
+ "X-Permitted-Cross-Domain-Policies": "none",
+ "X-Xss-Protection": "1; mode=block"
+ },
+ "status_code": 201,
+ "type": "ok"
+ }
+ }
+] \ No newline at end of file
diff --git a/test/support/cassettes/zones_manager/create/valid_parameters.json b/test/support/cassettes/zones_manager/create/valid_parameters.json
deleted file mode 100644
index 0637a08..0000000
--- a/test/support/cassettes/zones_manager/create/valid_parameters.json
+++ /dev/null
@@ -1 +0,0 @@
-[] \ No newline at end of file
diff --git a/test/support/cassettes/zones_manager/show/not_found.json b/test/support/cassettes/zones_manager/show/not_found.json
new file mode 100644
index 0000000..a989d91
--- /dev/null
+++ b/test/support/cassettes/zones_manager/show/not_found.json
@@ -0,0 +1,31 @@
+[
+ {
+ "request": {
+ "body": "",
+ "headers": {
+ "X-API-Key": "Locaweb2016"
+ },
+ "method": "get",
+ "options": [],
+ "request_body": "",
+ "url": "http://cpro36999.systemintegration.locaweb.com.br/api/v1/servers/localhost/zones/it-will-never-exist.on.the.art."
+ },
+ "response": {
+ "body": "{\"error\": \"Could not find domain 'it-will-never-exist.on.the.art.'\"}",
+ "headers": {
+ "Access-Control-Allow-Origin": "*",
+ "Connection": "close",
+ "Content-Length": "68",
+ "Content-Security-Policy": "default-src 'self'; style-src 'self' 'unsafe-inline'",
+ "Content-Type": "application/json",
+ "Server": "PowerDNS/4.0.1",
+ "X-Content-Type-Options": "nosniff",
+ "X-Frame-Options": "deny",
+ "X-Permitted-Cross-Domain-Policies": "none",
+ "X-Xss-Protection": "1; mode=block"
+ },
+ "status_code": 422,
+ "type": "ok"
+ }
+ }
+] \ No newline at end of file
diff --git a/test/support/cassettes/zones_manager/show/success.json b/test/support/cassettes/zones_manager/show/success.json
new file mode 100644
index 0000000..8f9a935
--- /dev/null
+++ b/test/support/cassettes/zones_manager/show/success.json
@@ -0,0 +1,31 @@
+[
+ {
+ "request": {
+ "body": "",
+ "headers": {
+ "X-API-Key": "Locaweb2016"
+ },
+ "method": "get",
+ "options": [],
+ "request_body": "",
+ "url": "http://cpro36999.systemintegration.locaweb.com.br/api/v1/servers/localhost/zones/my-domain.art."
+ },
+ "response": {
+ "body": "{\"account\": \"\", \"dnssec\": false, \"id\": \"my-domain.art.\", \"kind\": \"Native\", \"last_check\": 0, \"masters\": [], \"name\": \"my-domain.art.\", \"notified_serial\": 0, \"rrsets\": [{\"comments\": [], \"name\": \"my-domain.art.\", \"records\": [{\"content\": \"a.misconfigured.powerdns.server. hostmaster.my-domain.art. 2016060601 10800 3600 604800 3600\", \"disabled\": false}], \"ttl\": 3600, \"type\": \"SOA\"}], \"serial\": 2016060601, \"soa_edit\": \"\", \"soa_edit_api\": \"\", \"url\": \"api/v1/servers/localhost/zones/my-domain.art.\"}",
+ "headers": {
+ "Access-Control-Allow-Origin": "*",
+ "Connection": "close",
+ "Content-Length": "493",
+ "Content-Security-Policy": "default-src 'self'; style-src 'self' 'unsafe-inline'",
+ "Content-Type": "application/json",
+ "Server": "PowerDNS/4.0.1",
+ "X-Content-Type-Options": "nosniff",
+ "X-Frame-Options": "deny",
+ "X-Permitted-Cross-Domain-Policies": "none",
+ "X-Xss-Protection": "1; mode=block"
+ },
+ "status_code": 200,
+ "type": "ok"
+ }
+ }
+] \ No newline at end of file
diff --git a/test/support/cassettes/zones_manager/show/valid_record.json b/test/support/cassettes/zones_manager/show/valid_record.json
deleted file mode 100644
index 75d348d..0000000
--- a/test/support/cassettes/zones_manager/show/valid_record.json
+++ /dev/null
@@ -1,27 +0,0 @@
-[
- {
- "request": {
- "body": "",
- "headers": {
- "X-API-Key": "S3cr3t-T0k3n"
- },
- "method": "get",
- "options": [],
- "request_body": "",
- "url": "http://my-powerdns.api/servers/localhost/zones/my-domain.tst"
- },
- "response": {
- "body": "{\"id\":\"my-domain.tst.\",\"url\":\"/servers/localhost/zones/my-domain.tst.\",\"name\":\"my-domain.tst\",\"kind\":\"Native\",\"dnssec\":false,\"account\":\"\",\"masters\":[],\"serial\":2016060601,\"notified_serial\":0,\"last_check\":0,\"soa_edit_api\":\"\",\"soa_edit\":\"\",\"records\":[{\"name\":\"my-domain.tst\",\"type\":\"NS\",\"ttl\":3600,\"disabled\":false,\"content\":\"ns2.my-powerdns.api\"},{\"name\":\"my-domain.tst\",\"type\":\"NS\",\"ttl\":3600,\"disabled\":false,\"content\":\"ns1.my-powerdns.api\"},{\"name\":\"my-domain.tst\",\"type\":\"SOA\",\"ttl\":3600,\"disabled\":false,\"content\":\"a.misconfigured.powerdns.server hostmaster.my-domain.tst 2016060601 10800 3600 604800 3600\"}],\"comments\":[]}",
- "headers": {
- "Transfer-Encoding": "chunked",
- "Access-Control-Allow-Origin": "*",
- "Connection": "close",
- "Content-Length": "717",
- "Content-Type": "application/json",
- "Server": "PowerDNS/3.4.8"
- },
- "status_code": 200,
- "type": "ok"
- }
- }
-]
diff --git a/test/support/fake_config.exs b/test/support/fake_config.exs
index e624d8e..9f95fc2 100644
--- a/test/support/fake_config.exs
+++ b/test/support/fake_config.exs
@@ -1,8 +1,11 @@
-defmodule PowerDNSx.FakeConfig do
- @app_config_token "4pp_S3cr37_T0k3n"
- @app_config_url "https://app-config-powerdns.test"
+defmodule PowerDNSex.FakeConfig do
+ @app_config_token "S3cr37_70k3n"
+ @app_config_url "https://my-powerdns.api"
def set_url, do: Application.put_env(:powerdns, :url, @app_config_url)
def set_token, do: Application.put_env(:powerdns, :token, @app_config_token)
+
+ def token, do: @app_config_token
+ def url, do: @app_config_url
end