mirror of
https://github.com/thegeeklab/corenetworks.git
synced 2024-11-14 06:40:39 +00:00
fix formatting and tests
This commit is contained in:
parent
a332423c45
commit
6393f7a4c7
@ -211,13 +211,20 @@ class CoreNetworks():
|
||||
|
||||
records = self.records(zone, params={"name": params["name"]})
|
||||
for r in records:
|
||||
if params["type"] == "CNAME" or r["type"] == "CNAME":
|
||||
if params["type"] == "CNAME" and r["type"] != "CNAME":
|
||||
raise CorenetworksError(
|
||||
"A record with the same name already exist ({name}). "
|
||||
"CNAME records cannot use the same name with other records.".format(
|
||||
name=r["name"]
|
||||
)
|
||||
)
|
||||
if params["type"] != "CNAME" and r["type"] == "CNAME":
|
||||
raise CorenetworksError(
|
||||
"A CNAME record with the same name already exist ({name}). "
|
||||
"CNAME records cannot use the same name with other records.".format(
|
||||
name=r["name"]
|
||||
)
|
||||
)
|
||||
|
||||
curr = copy.deepcopy(params)
|
||||
curr.pop("ttl")
|
||||
|
6
corenetworks/test/fixtures/callback.py
vendored
6
corenetworks/test/fixtures/callback.py
vendored
@ -31,7 +31,11 @@ def records_get_callback(request, context):
|
||||
if query_raw:
|
||||
query = dict((k.replace("[]", ""), v) for k, v in query_raw.items())
|
||||
|
||||
res = [d for d in records if d["type"].lower() in query["type"]]
|
||||
if query.get("type"):
|
||||
res = [d for d in records if d["type"].lower() in query["type"]]
|
||||
else:
|
||||
res = []
|
||||
|
||||
return "{}".format(json.dumps(res))
|
||||
else:
|
||||
return "{}".format(json.dumps(records))
|
||||
|
Loading…
Reference in New Issue
Block a user