-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update "classic" to "neo-classic" schema.json in test/resources/classic
- Loading branch information
1 parent
6d04b05
commit 5c20daf
Showing
1 changed file
with
23 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,30 @@ | ||
import sys | ||
from pathlib import Path | ||
import unittest | ||
import json | ||
from jsonschema import validate | ||
from pathlib import Path | ||
|
||
from .test_example_regression import CLASSIC, CURRENT | ||
from src.test.python.test_example_regression import CLASSIC, CURRENT | ||
|
||
CLASSIC_SCHEMA_DIR: Path = CLASSIC / "build" / "opentrackio" | ||
CLASSIC_SCHEMA_DIR: Path = CLASSIC | ||
CLASSIC_SCHEMA = CLASSIC_SCHEMA_DIR / "schema.json" | ||
|
||
PYDANTIC_SCHEMA_DIR: Path = CURRENT / "build" / "opentrackio" | ||
PYDANTIC_SCHEMA = PYDANTIC_SCHEMA_DIR / "schema.json" | ||
CURRENT_SCHEMA_DIR: Path = CURRENT | ||
CURRENT_SCHEMA = CURRENT_SCHEMA_DIR / "schema.json" | ||
|
||
|
||
class schemaTestCases(unittest.TestCase): | ||
|
||
def test_current_schema_against_classic_schema(self): | ||
with open(CLASSIC_SCHEMA) as classic_schema_file: | ||
classic_schema = json.load(classic_schema_file) | ||
with open(CURRENT_SCHEMA) as current_schema_file: | ||
current_schema = json.load(current_schema_file) | ||
with open("/tmp/sorted_classic_schema_file.json", "w") as sclsf: | ||
json.dump(classic_schema, sclsf, indent=4, sort_keys=True) | ||
with open("/tmp/sorted_current_schema_file.json", "w") as scusf: | ||
json.dump(current_schema, scusf, indent=4, sort_keys=True) | ||
self.assertEqual(classic_schema, current_schema) | ||
|
||
|
||
def test_pydantic_schema_against_classic_schema(self): | ||
with open(CLASSIC_SCHEMA) as classic_schema_file: | ||
classic_schema = json.load(classic_schema_file) | ||
with open(PYDANTIC_SCHEMA) as pydantic_schema_file: | ||
pydantic_schema = json.load(pydantic_schema_file) | ||
self.assertEqual(classic_schema, pydantic_schema) | ||
if __name__ == '__main__': | ||
unittest.main() |