How to use the ipwb.util.isValidCDXJ function in ipwb

To help you get started, we’ve selected a few ipwb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github oduwsdl / ipwb / tests / test_replay.py View on Github external
def test_cdxj_valid():
    # Missing fields
    assert not util.isValidCDXJ('test')
    # Valid SURT
    assert util.isValidCDXJ(r"""edu,odu,cs)/~salam 20160305192247 {"locator": "urn:ipfs/QmeVWGtnfuJ1QnpmtKKnyArVgEpq7v31kktEfh6c8mDiXE/QmZWKQRBNXNrVZ69LoGpMNJi5NU66gDhnGtQukWJepv7Kr", "encryption_method": "xor", "encryption_key": "radon", "mime_type": "text/html", "status_code": "200"}""")
    # Bad JSON in third field
    assert not util.isValidCDXJ(r"""edu,odu,cs)/ 20160305192247 radon""")
    # Valid SURT
    assert util.isValidCDXJ(r"""edu,odu,cs)/ 20160305192247 {}""")
    #Invalid datetime
    assert not util.isValidCDXJ(r"""edu,odu,cs)/ 2016030519224 {}""")
    # Invalid SURT URI, pywb catches its own ValueError
github oduwsdl / ipwb / tests / test_replay.py View on Github external
def test_cdxj_valid():
    # Missing fields
    assert not util.isValidCDXJ('test')
    # Valid SURT
    assert util.isValidCDXJ(r"""edu,odu,cs)/~salam 20160305192247 {"locator": "urn:ipfs/QmeVWGtnfuJ1QnpmtKKnyArVgEpq7v31kktEfh6c8mDiXE/QmZWKQRBNXNrVZ69LoGpMNJi5NU66gDhnGtQukWJepv7Kr", "encryption_method": "xor", "encryption_key": "radon", "mime_type": "text/html", "status_code": "200"}""")
    # Bad JSON in third field
    assert not util.isValidCDXJ(r"""edu,odu,cs)/ 20160305192247 radon""")
    # Valid SURT
    assert util.isValidCDXJ(r"""edu,odu,cs)/ 20160305192247 {}""")
    #Invalid datetime
    assert not util.isValidCDXJ(r"""edu,odu,cs)/ 2016030519224 {}""")
    # Invalid SURT URI, pywb catches its own ValueError
github oduwsdl / ipwb / tests / test_replay.py View on Github external
def test_cdxj_valid():
    # Missing fields
    assert not util.isValidCDXJ('test')
    # Valid SURT
    assert util.isValidCDXJ(r"""edu,odu,cs)/~salam 20160305192247 {"locator": "urn:ipfs/QmeVWGtnfuJ1QnpmtKKnyArVgEpq7v31kktEfh6c8mDiXE/QmZWKQRBNXNrVZ69LoGpMNJi5NU66gDhnGtQukWJepv7Kr", "encryption_method": "xor", "encryption_key": "radon", "mime_type": "text/html", "status_code": "200"}""")
    # Bad JSON in third field
    assert not util.isValidCDXJ(r"""edu,odu,cs)/ 20160305192247 radon""")
    # Valid SURT
    assert util.isValidCDXJ(r"""edu,odu,cs)/ 20160305192247 {}""")
    #Invalid datetime
    assert not util.isValidCDXJ(r"""edu,odu,cs)/ 2016030519224 {}""")
    # Invalid SURT URI, pywb catches its own ValueError
github oduwsdl / ipwb / tests / test_replay.py View on Github external
def test_cdxj_valid():
    # Missing fields
    assert not util.isValidCDXJ('test')
    # Valid SURT
    assert util.isValidCDXJ(r"""edu,odu,cs)/~salam 20160305192247 {"locator": "urn:ipfs/QmeVWGtnfuJ1QnpmtKKnyArVgEpq7v31kktEfh6c8mDiXE/QmZWKQRBNXNrVZ69LoGpMNJi5NU66gDhnGtQukWJepv7Kr", "encryption_method": "xor", "encryption_key": "radon", "mime_type": "text/html", "status_code": "200"}""")
    # Bad JSON in third field
    assert not util.isValidCDXJ(r"""edu,odu,cs)/ 20160305192247 radon""")
    # Valid SURT
    assert util.isValidCDXJ(r"""edu,odu,cs)/ 20160305192247 {}""")
    #Invalid datetime
    assert not util.isValidCDXJ(r"""edu,odu,cs)/ 2016030519224 {}""")
    # Invalid SURT URI, pywb catches its own ValueError
github oduwsdl / ipwb / tests / test_replay.py View on Github external
def test_cdxj_valid():
    # Missing fields
    assert not util.isValidCDXJ('test')
    # Valid SURT
    assert util.isValidCDXJ(r"""edu,odu,cs)/~salam 20160305192247 {"locator": "urn:ipfs/QmeVWGtnfuJ1QnpmtKKnyArVgEpq7v31kktEfh6c8mDiXE/QmZWKQRBNXNrVZ69LoGpMNJi5NU66gDhnGtQukWJepv7Kr", "encryption_method": "xor", "encryption_key": "radon", "mime_type": "text/html", "status_code": "200"}""")
    # Bad JSON in third field
    assert not util.isValidCDXJ(r"""edu,odu,cs)/ 20160305192247 radon""")
    # Valid SURT
    assert util.isValidCDXJ(r"""edu,odu,cs)/ 20160305192247 {}""")
    #Invalid datetime
    assert not util.isValidCDXJ(r"""edu,odu,cs)/ 2016030519224 {}""")
    # Invalid SURT URI, pywb catches its own ValueError