diff --git a/src/registry_schemas/example_data/schema_data.py b/src/registry_schemas/example_data/schema_data.py index 9cbf9c1..8fe364b 100644 --- a/src/registry_schemas/example_data/schema_data.py +++ b/src/registry_schemas/example_data/schema_data.py @@ -914,25 +914,26 @@ } } - ALTERATION = { 'provisionsRemoved': False, - 'alterCorpType': { - 'corpType': 'benefitCompany' + 'business': { + 'identifier': 'BC1234567', + 'legalType': 'BC' }, - 'alterCorpName': { - 'legalName': 'new name', - 'nrNumber': 'NR123567' + 'nameRequest': { + 'nrNumber': 'NR 8798956', + 'legalName': 'HAULER MEDIA INC.', + 'legalType': 'BC' }, - 'alterNameTranslations': { - 'newTranslations': ['Financière de l’Odet'], - 'modifiedTranslations': [{ - 'oldValue': 'A1 Ltd.', - 'newValue': 'Société Générale' + 'nameTranslations': { + 'new': ['MÉDIAS DE TRANSPORT INC.'], + 'modified': [{ + 'oldValue': 'A1 LTD.', + 'newValue': 'SOCIÉTÉ GÉNÉRALE' }], - 'ceasedTranslations': ['B1', 'B2'] + 'ceased': ['B1', 'B2'] }, - 'alterShareStructure': { + 'shareStructure': { 'resolutionDates': ['2020-05-23', '2020-06-01'], 'shareClasses': [{ 'name': 'class1', @@ -944,7 +945,7 @@ 'hasParValue': True, 'hasRightsOrRestrictions': False, 'series': [{ - 'name': 'class1', + 'name': 'series1', 'priority': 1, 'maxNumberOfShares': 600, 'hasMaximumShares': True, diff --git a/src/registry_schemas/schemas/alteration.json b/src/registry_schemas/schemas/alteration.json index 64bd97c..a849cc5 100644 --- a/src/registry_schemas/schemas/alteration.json +++ b/src/registry_schemas/schemas/alteration.json @@ -1,77 +1,44 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://bcrs.gov.bc.ca/.well_known/schemas/alteration", - "anyOf": [ - {"required": ["alterCorpType"]}, - {"required": ["alterCorpName"]}, - {"required": ["alterNameTranslations"]}, - {"required": ["alterShareStructure"]} - ], - "type": "object", - "title": "Alteration Filing", - "properties": { - "provisionsRemoved": { - "type": "boolean", - "title": "Has Pre-existing company provisions?" + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://bcrs.gov.bc.ca/.well_known/schemas/alteration", + "anyOf": [ + { "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/business" }, + { "required": ["nameRequest"] }, + { "required": ["nameTranslations"] }, + { "required": ["shareStructure"] } + ], + "type": "object", + "title": "Alteration Filing", + "properties": { + "provisionsRemoved": { + "type": "boolean", + "title": "Has Pre-existing company provisions?" + }, + "nameRequest": { + "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/name_request" + }, + "nameTranslations": { + "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/name_translations" + }, + "shareStructure": { + "type": "object", + "title": "New Share Structure", + "required": ["resolutionDates", "shareClasses"], + "properties": { + "resolutionDates": { + "type": "array", + "items": { + "type": "string", + "format": "date" + } }, - "alterCorpType": { - "type": "object", - "required": [ - "corpType" - ], - "properties": { - "corpType": { - "type": "string", - "title": "Corp type to which the business needs to be converted", - "enum": [ - "benefitCompany" - ] - } - } - }, - "alterCorpName": { - "type": "object", - "required": [ - "legalName", - "nrNumber" - ], - "properties": { - "legalName": { - "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/business#/definitions/legalName", - "title": "New Legal Name" - }, - "nrNumber": { - "type": "string", - "maxLength": 10, - "title": "Name Request Number" - } - } - }, - "alterNameTranslations": { - "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/alteration_name_translations" - }, - "alterShareStructure": { - "type": "object", - "title": "New Share Structure", - "required": [ - "resolutionDates", - "shareClasses" - ], - "properties": { - "resolutionDates": { - "type": "array", - "items": { - "type": "string", - "format": "date" - } - }, - "shareClasses": { - "type": "array", - "items": { - "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/share_class#/definitions/shareClass" - } - } - } + "shareClasses": { + "type": "array", + "items": { + "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/share_class#/definitions/shareClass" + } } + } } + } } diff --git a/src/registry_schemas/schemas/alteration_name_translations.json b/src/registry_schemas/schemas/alteration_name_translations.json deleted file mode 100644 index 7dbccc2..0000000 --- a/src/registry_schemas/schemas/alteration_name_translations.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://bcrs.gov.bc.ca/.well_known/schemas/alteration_name_translations", - "type": "object", - "title": "Change of name translations", - "anyOf": [ - {"required": ["modifiedTranslations"]}, - {"required": ["ceasedTranslations"]}, - {"required": ["newTranslations"]} - ], - "properties": { - "newTranslations": { - "type": "array", - "items": { - "type": "string", - "pattern": "^[ A-Za-zÀ-ÿ_@./#’&+-]*$" - } - }, - "modifiedTranslations": { - "type": "array", - "items": { - "type": "object", - "required": [ - "oldValue", - "newValue" - ], - "properties": { - "oldValue": { - "type": "string", - "title": "Old Translation" - }, - "newValue": { - "type": "string", - "title": "New Translation", - "pattern": "^[ A-Za-zÀ-ÿ_@./#’&+-]*$" - } - } - } - }, - "ceasedTranslations": { - "type": "array", - "items": { - "type": "string" - } - } - } -} diff --git a/src/registry_schemas/schemas/business.json b/src/registry_schemas/schemas/business.json index 275f66d..4bf4b57 100644 --- a/src/registry_schemas/schemas/business.json +++ b/src/registry_schemas/schemas/business.json @@ -1,159 +1,136 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://bcrs.gov.bc.ca/.well_known/schemas/business", - "type": "object", - "title": "The Businesses Schema", - "required": [ - "business" - ], - "definitions": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://bcrs.gov.bc.ca/.well_known/schemas/business", + "type": "object", + "title": "The Businesses Schema", + "required": ["business"], + "definitions": { + "legalName": { + "type": "string", + "title": "The Legal_name Schema", + "default": "", + "examples": ["legal_name"], + "pattern": "^(.*)$" + } + }, + "properties": { + "business": { + "$id": "#/properties/business", + "type": "object", + "title": "The Business Schema", + "required": ["identifier"], + "properties": { + "cacheId": { + "type": "integer", + "title": "The cache_id of the most current ledger record.", + "default": 0, + "examples": ["1200"] + }, + "lastLedgerTimestamp": { + "type": "string", + "format": "date-time", + "title": "The timestamp of the most current ledger record.", + "default": "", + "examples": ["1970-01-01T00:00:00+00:00"] + }, + "lastPreBobFilingTimestamp": { + "type": "string", + "format": "date-time", + "title": "The timestamp of the last ledger record before data load from Cobrs by Bob.", + "default": "", + "examples": ["1970-01-01T00:00:00+00:00"] + }, + "dissolutionDate": { + "type": "string", + "format": "date", + "title": "The Dissolution_date Schema", + "default": "", + "examples": ["1970-01-01"] + }, + "fiscalYearEndDate": { + "type": "string", + "format": "date", + "title": "The Fiscal_year_end_date Schema", + "default": "", + "examples": ["1970-01-01"] + }, + "foundingDate": { + "type": "string", + "format": "date-time", + "title": "The Founding_date Schema", + "default": "", + "examples": ["1970-01-01T00:00:00+00:00"] + }, + "identifier": { + "type": "string", + "title": "The Identifier Schema", + "default": "", + "examples": ["CP1234567"], + "pattern": "^[A-Z]{1,3}[0-9]{7}$" + }, "legalName": { - "type": "string", - "title": "The Legal_name Schema", - "default": "", - "examples": [ - "legal_name" - ], - "pattern": "^(.*)$" - } - }, - "properties": { - "business": { - "$id": "#/properties/business", - "type": "object", - "title": "The Business Schema", - "required": [ - "identifier", - "legalName" - ], - "properties": { - "cacheId": { - "type": "integer", - "title": "The cache_id of the most current ledger record.", - "default": 0, - "examples": [ - "1200" - ] - }, - "lastLedgerTimestamp": { - "type": "string", - "format": "date-time", - "title": "The timestamp of the most current ledger record.", - "default": "", - "examples": [ - "1970-01-01T00:00:00+00:00" - ] - }, - "lastPreBobFilingTimestamp": { - "type": "string", - "format": "date-time", - "title": "The timestamp of the last ledger record before data load from Cobrs by Bob.", - "default": "", - "examples": [ - "1970-01-01T00:00:00+00:00" - ] - }, - "dissolutionDate": { - "type": "string", - "format": "date", - "title": "The Dissolution_date Schema", - "default": "", - "examples": [ - "1970-01-01" - ] - }, - "fiscalYearEndDate": { - "type": "string", - "format": "date", - "title": "The Fiscal_year_end_date Schema", - "default": "", - "examples": [ - "1970-01-01" - ] - }, - "foundingDate": { - "type": "string", - "format": "date-time", - "title": "The Founding_date Schema", - "default": "", - "examples": [ - "1970-01-01T00:00:00+00:00" - ] - }, - "identifier": { - "type": "string", - "title": "The Identifier Schema", - "default": "", - "examples": [ - "CP1234567" - ], - "pattern": "^[A-Z]{1,3}[0-9]{7}$" - }, - "legalName": { - "$ref": "#/definitions/legalName" - }, - "legalType": { - "type": "string", - "title": "The Legal Type of the business.", - "default": "BC", - "enum": [ - "A", - "B", - "BC", - "C", - "CC", - "CCC", - "CEM", - "CP", - "CS", - "CUL", - "EPR", - "FI", - "FOR", - "GP", - "LIC", - "LIB", - "LL", - "LLC", - "LP", - "MF", - "PA", - "PAR", - "PFS", - "QA", - "QB", - "QC", - "QD", - "QE", - "REG", - "RLY", - "S", - "SB", - "SP", - "T", - "TMY", - "ULC", - "UQA", - "UQB", - "UQC", - "UQD", - "UQE", - "XCP", - "XL", - "XP", - "XS" - ] - }, - "taxId": { - "type": "string", - "title": "The Tax_id Schema", - "default": "", - "examples": [ - "123456789" - ], - "pattern": "^[0-9]{9}$" - } - } + "$ref": "#/definitions/legalName" + }, + "legalType": { + "type": "string", + "title": "The Legal Type of the business.", + "default": "BC", + "enum": [ + "A", + "B", + "BC", + "C", + "CC", + "CCC", + "CEM", + "CP", + "CS", + "CUL", + "EPR", + "FI", + "FOR", + "GP", + "LIC", + "LIB", + "LL", + "LLC", + "LP", + "MF", + "PA", + "PAR", + "PFS", + "QA", + "QB", + "QC", + "QD", + "QE", + "REG", + "RLY", + "S", + "SB", + "SP", + "T", + "TMY", + "ULC", + "UQA", + "UQB", + "UQC", + "UQD", + "UQE", + "XCP", + "XL", + "XP", + "XS" + ] + }, + "taxId": { + "type": "string", + "title": "The Tax_id Schema", + "default": "", + "examples": ["123456789"], + "pattern": "^[0-9]{9}$" } + } } -} \ No newline at end of file + } +} diff --git a/src/registry_schemas/schemas/filing.json b/src/registry_schemas/schemas/filing.json index c72e1d3..4388751 100644 --- a/src/registry_schemas/schemas/filing.json +++ b/src/registry_schemas/schemas/filing.json @@ -1,242 +1,239 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://bcrs.gov.bc.ca/.well_known/schemas/filing", - "definitions": { - "office": { - "properties": { - "shippingAddress": { - "allOf": [ - { - "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/address" - }, - { - "properties": { - "type": { - "enum": [ - "registered_office", - "legal_office" - ] - } - }, - "required": [ - "type" - ] - } - ] + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://bcrs.gov.bc.ca/.well_known/schemas/filing", + "definitions": { + "office": { + "properties": { + "shippingAddress": { + "allOf": [ + { + "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/address" + }, + { + "properties": { + "type": { + "enum": ["registered_office", "legal_office"] } + }, + "required": ["type"] } + ] + } + } + }, + "businessOffice": { + "type": "object", + "properties": { + "mailingAddress": { + "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/address" }, - "businessOffice": { - "type": "object", - "properties": { - "mailingAddress": { - "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/address" - }, - "legalAddress": { - "$ref": "#/definitions/office" - } + "legalAddress": { + "$ref": "#/definitions/office" + } + } + }, + "filing_header": { + "$id": "#filing_header", + "type": "object", + "required": ["header"], + "properties": { + "header": { + "type": "object", + "required": ["name", "certifiedBy", "date"], + "properties": { + "name": { + "type": "string", + "title": "The type of the main filing.", + "enum": [ + "annualReport", + "changeOfDirectors", + "changeOfAddress", + "voluntaryDissolution", + "specialResolution", + "changeOfName", + "incorporationApplication", + "amalgamationApplication", + "dissolved", + "amendedAGM", + "restorationApplication", + "amendedAnnualReport", + "amendedChangeOfDirectors", + "voluntaryLiquidation", + "appointReceiver", + "continuedOut", + "correction", + "alteration", + "conversion" + ] + }, + "availableOnPaperOnly": { + "type": "boolean" + }, + "date": { + "type": "string", + "format": "date", + "title": "The submission date of the final version of the filing." + }, + "certifiedBy": { + "type": "string" + }, + "email": { + "type": "string", + "format": "email" + }, + "filingId": { + "type": "integer", + "title": "The id of the filing.", + "default": 0, + "examples": ["1200"] + }, + "effectiveDate": { + "type": "string", + "format": "date-time", + "title": "The date and time a filing should become valid and applied.", + "default": "", + "examples": ["1970-01-01T00:00:00+00:00"] + }, + "paymentToken": { + "type": "string", + "title": "A valid payment token for this filing against this business." + }, + "submitter": { + "type": "string", + "title": "Account name of the person submitting this filing." + }, + "status": { + "type": "string", + "title": "The status of this filing.", + "enum": ["DRAFT", "PENDING", "COMPLETED", "ERROR"] + }, + "affectedFilings": { + "type": "array", + "title": "List of affected filings (ids) from this filing.", + "items": { + "type": "integer" + } + }, + "isCorrected": { + "type": "boolean", + "title": "Has this filing been corrected?" + }, + "isCorrectionPending": { + "type": "boolean", + "title": "Is a correction pending for this filing?" + }, + "comments": { + "type": "array", + "title": "List of filing comments.", + "items": { + "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/comment" + } + }, + "waiveFees": { + "type": "boolean" + }, + "priority": { + "type": "boolean" + }, + "routingSlipNumber": { + "type": "string", + "title": "A valid routing slip number in case of a staff filing.", + "maxLength": 9, + "pattern": "^\\d{9}$" + }, + "folioNumber": { + "type": "string", + "title": "A folio number used for payment tracking purposes.", + "maxLength": 50 + }, + "datNumber": { + "type": "string", + "title": "A dat number used for payment tracking purposes.", + "maxLength": 10, + "examples": ["C234567890"], + "pattern": "^[A-Z]{1}[0-9]{9}$" + }, + "bcolAccountNumber": { + "type": "string", + "title": "BCOL account number.", + "maxLength": 6, + "examples": ["180670"], + "pattern": "^(.*)$" + }, + "sbcAccount": { + "type": "integer", + "title": "authorization system account number.", + "examples": [416] } + } + } + } + } + }, + "type": "object", + "title": "Registry Filing Item", + "required": ["filing"], + "properties": { + "filing": { + "allOf": [ + { + "$ref": "#/definitions/filing_header" }, - "filing_header": { - "$id": "#filing_header", - "type": "object", - "required": [ - "header" - ], + { + "if": { "properties": { - "header": { - "type": "object", - "required": [ - "name", - "certifiedBy", - "date" - ], - "properties": { - "name": { - "type": "string", - "title": "The type of the main filing.", - "enum": [ - "annualReport", - "changeOfDirectors", - "changeOfAddress", - "voluntaryDissolution", - "specialResolution", - "changeOfName", - "incorporationApplication", - "amalgamationApplication", - "dissolved", - "amendedAGM", - "restorationApplication", - "amendedAnnualReport", - "amendedChangeOfDirectors", - "voluntaryLiquidation", - "appointReceiver", - "continuedOut", - "correction", - "alteration", - "conversion" - ] - }, - "availableOnPaperOnly": { - "type": "boolean" - }, - "date": { - "type": "string", - "format": "date", - "title": "The submission date of the final version of the filing." - }, - "certifiedBy": { - "type": "string" - }, - "email": { - "type": "string", - "format": "email" - }, - "filingId": { - "type": "integer", - "title": "The id of the filing.", - "default": 0, - "examples": [ - "1200" - ] - }, - "effectiveDate": { - "type": "string", - "format": "date-time", - "title": "The date and time a filing should become valid and applied.", - "default": "", - "examples": [ - "1970-01-01T00:00:00+00:00" - ] - }, - "paymentToken": { - "type": "string", - "title": "A valid payment token for this filing against this business." - }, - "submitter": { - "type": "string", - "title": "Account name of the person submitting this filing." - }, - "status": { - "type": "string", - "title": "The status of this filing.", - "enum": [ - "DRAFT", - "PENDING", - "COMPLETED", - "ERROR" - ] - }, - "affectedFilings": { - "type": "array", - "title": "List of affected filings (ids) from this filing.", - "items": { - "type": "integer" - } - }, - "isCorrected": { - "type": "boolean", - "title": "Has this filing been corrected?" - }, - "isCorrectionPending": { - "type": "boolean", - "title": "Is a correction pending for this filing?" - }, - "comments": { - "type": "array", - "title": "List of filing comments.", - "items": { - "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/comment" - } - }, - "waiveFees": { - "type": "boolean" - }, - "priority": { - "type": "boolean" - }, - "routingSlipNumber": { - "type": "string", - "title": "A valid routing slip number in case of a staff filing.", - "maxLength": 9, - "pattern": "^\\d{9}$" - }, - "folioNumber": { - "type": "string", - "title": "A folio number used for payment tracking purposes.", - "maxLength": 50 - } + "header": { + "properties": { + "name": { + "not": { + "const": "incorporationApplication" } + } } + } } + }, + "then": { + "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/business" + } } - }, - "type": "object", - "title": "Registry Filing Item", - "required": [ - "filing" - ], - "properties": { - "filing": { - "allOf": [ - { - "$ref": "#/definitions/filing_header" - }, - { - "if": { - "properties": { - "header": { - "properties": { - "name": { - "not": { - "const": "incorporationApplication" - } - } - } - } - } - }, - "then": { - "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/business" - } - } - ], - "anyOf": [ - { - "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/annual_report" - }, - { - "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/change_of_address" - }, - { - "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/change_of_directors" - }, - { - "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/voluntary_dissolution" - }, - { - "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/special_resolution" - }, - { - "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/change_of_name" - }, - { - "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/incorporationApplication" - }, - { - "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/correction" - }, - { - "title": "Placeholder until all filing types are defined.", - "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/stub_filing" - }, - { - "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/conversion" - }, - { - "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/alteration" - } - ] + ], + "anyOf": [ + { + "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/annual_report" + }, + { + "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/change_of_address" + }, + { + "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/change_of_directors" + }, + { + "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/voluntary_dissolution" + }, + { + "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/special_resolution" + }, + { + "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/change_of_name" + }, + { + "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/incorporationApplication" + }, + { + "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/correction" + }, + { + "title": "Placeholder until all filing types are defined.", + "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/stub_filing" + }, + { + "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/conversion" + }, + { + "$ref": "https://bcrs.gov.bc.ca/.well_known/schemas/alteration" } + ] } + } } diff --git a/src/registry_schemas/schemas/name_translations.json b/src/registry_schemas/schemas/name_translations.json new file mode 100644 index 0000000..468fd66 --- /dev/null +++ b/src/registry_schemas/schemas/name_translations.json @@ -0,0 +1,44 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://bcrs.gov.bc.ca/.well_known/schemas/name_translations", + "type": "object", + "title": "Change of name translations", + "anyOf": [ + { "required": ["modified"] }, + { "required": ["ceased"] }, + { "required": ["new"] } + ], + "properties": { + "new": { + "type": "array", + "items": { + "type": "string", + "pattern": "^[ A-Za-zÀ-ÿ_@./#’&+-]*$" + } + }, + "modified": { + "type": "array", + "items": { + "type": "object", + "required": ["oldValue", "newValue"], + "properties": { + "oldValue": { + "type": "string", + "title": "Old Translation" + }, + "newValue": { + "type": "string", + "title": "New Translation", + "pattern": "^[ A-Za-zÀ-ÿ_@./#’&+-]*$" + } + } + } + }, + "ceased": { + "type": "array", + "items": { + "type": "string" + } + } + } +} diff --git a/src/registry_schemas/version.py b/src/registry_schemas/version.py index 01c192e..a78f5cf 100644 --- a/src/registry_schemas/version.py +++ b/src/registry_schemas/version.py @@ -22,4 +22,4 @@ Development release segment: .devN """ -__version__ = '2.5.17' # pylint: disable=invalid-name +__version__ = '2.5.18' # pylint: disable=invalid-name diff --git a/tests/unit/schema_data.py b/tests/unit/schema_data.py index b0fbfbe..8ba6db8 100644 --- a/tests/unit/schema_data.py +++ b/tests/unit/schema_data.py @@ -40,6 +40,6 @@ ('voluntary_dissolution.json'), ('agreement_type.json'), ('alteration.json'), - ('alteration_name_translations.json'), + ('name_translations.json'), ('conversion.json') ] diff --git a/tests/unit/test_alteration.py b/tests/unit/test_alteration.py index 6d25098..81f59fa 100644 --- a/tests/unit/test_alteration.py +++ b/tests/unit/test_alteration.py @@ -34,9 +34,9 @@ def test_alteration_schema(): def test_validate_valid_alteration_with_any_required_element(): """Assert valid if any of the required alterations is present.""" alteration_json = copy.deepcopy(ALTERATION) - del alteration_json['alterCorpName'] - del alteration_json['alterCorpType'] - del alteration_json['alterNameTranslations'] + del alteration_json['nameRequest'] + del alteration_json['business'] + del alteration_json['nameTranslations'] is_valid, errors = validate(alteration_json, 'alteration') @@ -51,10 +51,10 @@ def test_validate_valid_alteration_with_any_required_element(): def test_validate_invalid_alteration_with_no_required_elements(): """Assert not valid if none of the required alterations are present.""" alteration_json = copy.deepcopy(ALTERATION) - del alteration_json['alterCorpName'] - del alteration_json['alterCorpType'] - del alteration_json['alterNameTranslations'] - del alteration_json['alterShareStructure'] + del alteration_json['nameRequest'] + del alteration_json['business'] + del alteration_json['nameTranslations'] + del alteration_json['shareStructure'] is_valid, errors = validate(alteration_json, 'alteration') @@ -69,22 +69,7 @@ def test_validate_invalid_alteration_with_no_required_elements(): def test_validate_invalid_corp_name_alteration(): """Assert not valid if corp name alteration does not contain required elements.""" alteration_json = copy.deepcopy(ALTERATION) - del alteration_json['alterCorpName']['legalName'] - - is_valid, errors = validate(alteration_json, 'alteration') - - if errors: - for err in errors: - print(err.message) - print(errors) - - assert not is_valid - - -def test_validate_invalid_corp_type_alteration(): - """Assert not valid if corp type is not valid.""" - alteration_json = copy.deepcopy(ALTERATION) - alteration_json['alterCorpType']['corpType'] = 'ZZ' + del alteration_json['nameRequest']['legalType'] is_valid, errors = validate(alteration_json, 'alteration') @@ -99,9 +84,9 @@ def test_validate_invalid_corp_type_alteration(): def test_validate_invalid_name_translation_alteration(): """Assert not valid if name translation alteration does not contain mandatory elements.""" alteration_json = copy.deepcopy(ALTERATION) - del alteration_json['alterNameTranslations']['modifiedTranslations'] - del alteration_json['alterNameTranslations']['ceasedTranslations'] - del alteration_json['alterNameTranslations']['newTranslations'] + del alteration_json['nameTranslations']['modified'] + del alteration_json['nameTranslations']['ceased'] + del alteration_json['nameTranslations']['new'] is_valid, errors = validate(alteration_json, 'alteration') @@ -116,7 +101,7 @@ def test_validate_invalid_name_translation_alteration(): def test_validate_invalid_share_structure_alteration(): """Assert not valid if share structure alteration does not contain required elements.""" alteration_json = copy.deepcopy(ALTERATION) - del alteration_json['alterShareStructure']['shareClasses'] + del alteration_json['shareStructure']['shareClasses'] is_valid, errors = validate(alteration_json, 'alteration') diff --git a/tests/unit/test_registry_schema_utils.py b/tests/unit/test_registry_schema_utils.py index d624277..4476f97 100644 --- a/tests/unit/test_registry_schema_utils.py +++ b/tests/unit/test_registry_schema_utils.py @@ -45,9 +45,8 @@ def test_validate_business_schema_on_empty_schema(): """Assert that the schema is performing as expected.""" data = { 'business': { - 'foundingDate': '2007-04-08T00:00:00+00:00', - 'identifier': 'CP1234567' - }, + 'legalType': 'BC' + } } is_valid, errors = validate(data, 'business', validate_schema=True)