def test_is_sorted():
     """Load schema versions to populate the class versions attribute and check if it is sorted correctly"""
     s = AS3Schema(version="3.9.0")
     s = AS3Schema(version="3.11.1")
     s = AS3Schema(version="3.10.0")
     s = AS3Schema(version="3.8.1")
     version_previous = None
     for version in s.versions:
         if version_previous:
             assert int(version_previous.replace(".", "")) > int(
                 version.replace(".", ""))
         version_previous = version
 def test_is_sorted():
     """Add versions to the class schema attribute and check if they are sorted based on version"""
     schema_previous = None
     s = AS3Schema(version="3.9.0")
     s = AS3Schema(version="3.11.1")
     s = AS3Schema(version="3.10.0")
     s = AS3Schema(version="3.8.1")
     for schema in s.schemas:
         if schema_previous:
             if not re.match("^[0-9]+$", schema.replace(".", "")):
                 continue
             assert int(schema_previous.replace(".", "")) > int(
                 schema.replace(".", ""))
         schema_previous = schema
def fixture_as3schema():
    s = AS3Schema()
    yield s
    # tear down / empty class attributes to prevent tests from influencing each other
    AS3Schema._latest_version = ""
    AS3Schema._versions = ()
    AS3Schema._schemas = {}
    AS3Schema._validators = {}
예제 #4
0
 def test_schemaupdate_targetdir(fixture_tmpdir):
     repodir = fixture_tmpdir + "/f5-appsvcs-extension"
     s = AS3Schema()
     s.updateschemas(repodir=repodir)
     assert Path(repodir + "/schema/latest/").exists()
예제 #5
0
 def test_version_is_latest_version():
     s = AS3Schema()
     assert s.latest_version == s.version
예제 #6
0
 def test_implicit_is_latest_true():
     s = AS3Schema()
     assert s.is_latest is True
예제 #7
0
 def test_is_latest_true():
     s = AS3Schema(version="latest")
     assert s.is_latest is True
예제 #8
0
 def test_is_latest_false():
     s = AS3Schema(version="3.8.1")
     assert s.is_latest is False
예제 #9
0
 def test_instanciate_older_version():
     s = AS3Schema(version="3.8.1")
     assert s.schema == s.schemas["3.8.1"]
예제 #10
0
def fixture_as3schema():
    s = AS3Schema()
    yield s
    # tear down / empty class attributes to prevent tests from influencing eachother
    AS3Schema._schemas = {}
    AS3Schema._schemas_ref_updated = {}