diff --git a/integration_tests/blockstack_integration_tests/scenarios/subdomains/subdomain_registrar.py b/integration_tests/blockstack_integration_tests/scenarios/subdomains/subdomain_registrar.py index a8a934077..d20090c64 100644 --- a/integration_tests/blockstack_integration_tests/scenarios/subdomains/subdomain_registrar.py +++ b/integration_tests/blockstack_integration_tests/scenarios/subdomains/subdomain_registrar.py @@ -27,6 +27,7 @@ import json import sys import os, subprocess import blockstack_client +import blockstack_zones import keylib import requests from blockstack_integration_tests.scenarios import testlib @@ -107,14 +108,22 @@ core_auth_token = False time.sleep(SLEEP_TIME) baz_sk = keylib.ECPrivateKey() - uri_rec = (blockstack_client.zonefile.url_to_uri_record("file:///tmp/baz.profile.json")) + uri_rec = blockstack_client.zonefile.url_to_uri_record("file:///tmp/baz.profile.json") owner_address = baz_sk.public_key().address() + zonefile_obj = { + '$origin' : "bar", + '$ttl' : 3600, + 'uri' : [uri_rec] + } + zonefile_str = blockstack_zones.make_zone_file(zonefile_obj) + requests.post("http://localhost:7103/register", - data = json.dumps({"subdomain": "bar", - "owner" : owner_address, - "uris" : [uri_rec]})) + data = json.dumps({"name": "bar", + "min_confs" : 0, + "owner_address" : owner_address, + "zonefile" : zonefile_str})) profile_raw = {"bar" : { "@type" : "Person", diff --git a/subdomain_registrar/subdomains_registrar.py b/subdomain_registrar/subdomains_registrar.py index 2eaa5bf5c..0be7bfe18 100644 --- a/subdomain_registrar/subdomains_registrar.py +++ b/subdomain_registrar/subdomains_registrar.py @@ -211,44 +211,35 @@ def parse_subdomain_request(input_str): schema = { 'type' : 'object', 'properties' : { - 'subdomain' : { + 'name' : { 'type': 'string', 'pattern': config.SUBDOMAIN_NAME_PATTERN }, - 'owner' : { + 'owner_address' : { 'type': 'string', 'pattern': schemas.OP_ADDRESS_PATTERN }, - 'uris' : { - 'type': 'array', - 'items': schemas.URI_RECORD_SCHEMA - }, - 'zonefile_str' : { + 'zonefile' : { 'type' : 'string', 'maxLength' : blockstack_constants.RPC_MAX_ZONEFILE_LEN } - } + }, + 'required':[ + 'name', 'owner_address', 'zonefile' + ], + 'additionalProperties' : True } request = json.loads(input_str) jsonschema.validate(request, schema) - - zonefile_str = None - if 'zonefile_str' in request: - zonefile_str = request['zonefile_str'] - elif 'uris' in request: - zonefile_dict = { - '$origin' : request['subdomain'], - '$ttl' : 3600, - 'uri' : request['uris'] - } - zonefile_str = blockstack_zones.make_zone_file(zonefile_dict) + + zonefile_str = str(request['zonefile']) if zonefile_str is None: raise Exception("Request lacked either a zonefile_str or an uris entry") - owner_entry = str(request['owner']) + owner_entry = str(request['owner_address']) return subdomains.Subdomain( - request['subdomain'], owner_entry, + request['name'], owner_entry, n=0, zonefile_str = zonefile_str) def run_registrar(domain_name):