Example #1
0
def test_from_charcode():
    assert Chepy(["314e", "61", "20",
                  "41"]).from_charcode().o == ["ㅎ", "a", " ", "A"]
Example #2
0
def test_xpath():
    assert (Chepy("tests/files/test.html").load_file().xpath_selector(
        "//title/text()").get_by_index(0).o == "Example Domain")
Example #3
0
def test_css():
    assert (Chepy("http://example.com").http_request().css_selector(
        "title").get_by_index(0).o == "<title>Example Domain</title>")
Example #4
0
def test_base64_decode():
    assert Chepy(
        "c29tZSByYW5kb20/IGRhdGE=").base64_decode().o == b"some random? data"
    assert (Chepy("QqxhNG/mMKtYPqoz64FVR42=").base64_decode(
        custom="./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
    ).o == b"some random? data")
Example #5
0
def test_extract_mac_address():
    assert (len(
        Chepy("01:23:45:67:89:ab | 127.0.0.1 | fE:dC:bA:98:76:54").
        extract_mac_address().o) == 2)
Example #6
0
def test_base58_decode():
    assert Chepy(
        "2UDrs31qcWSPi").base58_decode().output.decode() == "some data"
Example #7
0
def test_base32_encode():
    assert Chepy(
        "some data").base32_encode().output.decode() == "ONXW2ZJAMRQXIYI="
Example #8
0
def test_from_octral():
    assert Chepy(["141", "142", "30516"]).from_octal().o == ["a", "b", "ㅎ"]
Example #9
0
def test_html_encode():
    assert (Chepy('https://google.com&a="lol"').to_html_entity().o ==
            "https://google.com&amp;a=&quot;lol&quot;")
Example #10
0
def test_from_binary():
    assert Chepy(["01100001", "01100010", "01100011"]).from_binary().o == [
        "a",
        "b",
        "c",
    ]
Example #11
0
def test_to_octal():
    assert Chepy("abㅎ").to_octal().o == ["141", "142", "30516"]
Example #12
0
def test_to_binary():
    assert Chepy("abc").to_binary().o == ["01100001", "01100010", "01100011"]
Example #13
0
def test_from_decimal():
    assert Chepy([12622]).from_decimal().o == ["ㅎ"]
Example #14
0
def test_to_decimal():
    assert Chepy("aㅎ").to_decimal().o == [97, 12622]
Example #15
0
def test_trim():
    assert Chepy("\nlol ").trim().o == "lol"
Example #16
0
def test_html_decode():
    assert (Chepy("https://google.com&amp;a=&quot;lol&quot;").from_html_entity(
    ).o == 'https://google.com&a="lol"')
Example #17
0
def test_dict_to_json():
    assert (Chepy({
        "some": "data",
        "a": ["list", 1, True]
    }).dict_to_json().o == '{"some":"data","a":["list",1,true]}')
Example #18
0
def test_from_punycode():
    assert Chepy(b"mnchen-3ya").from_punycode().o == "münchen"
Example #19
0
def test_base85_decode():
    assert Chepy("F)Po,+Cno&@/").base85_decode().output.decode() == "some data"
Example #20
0
def test_to_punycode():
    assert Chepy("münchen").to_punycode().o == b"mnchen-3ya"
Example #21
0
def test_base64_encode():
    assert Chepy("some data").base64_encode().output.decode() == "c29tZSBkYXRh"
    assert (Chepy("some random? data").base64_encode(
        custom="./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
    ).o == b"QqxhNG/mMKtYPqoz64FVR42=")
Example #22
0
def test_encode_bruteforce():
    assert (Chepy("münchen한").encode_bruteforce().get_by_key("ascii").o ==
            b"m\\xfcnchen\\ud55c")
Example #23
0
def test_extract_email():
    assert (len(
        Chepy("tests/files/test.der").load_file().extract_email(
            is_binary=True).o) == 2)
Example #24
0
def test_decode_bruteforce():
    assert (Chepy("m\xfcnchen\ud55c").decode_bruteforce().get_by_key("utf_8").o
            == "münchen한")
Example #25
0
def test_extract_domains():
    assert (len(
        Chepy("https://google.com, https://google.com/app&lo=lol, \
                http://localhost:800, file://test, ftp://test,]").
        extract_domains().o) == 3)
Example #26
0
def test_to_braille():
    assert Chepy("secret message").to_braille().o == "⠎⠑⠉⠗⠑⠞⠀⠍⠑⠎⠎⠁⠛⠑"
Example #27
0
def test_extract_strings():
    assert len(
        Chepy("tests/files/hello").load_file().extract_strings().o) == 29
Example #28
0
def test_from_braille():
    assert Chepy("⠎⠑⠉⠗⠑⠞⠀⠍⠑⠎⠎⠁⠛⠑").from_braille().o == "secret message"
Example #29
0
def test_jpath():
    assert (Chepy("tests/files/test.json").load_file().jpath_selector(
        "[*].name.first").get_by_index(2).o == "Long")
Example #30
0
def test_to_charcode():
    assert Chepy("aㅎ").to_charcode().o == ["61", "314e"]