Ejemplo n.º 1
0
def test_from_charcode():
    assert Chepy(["314e", "61", "20",
                  "41"]).from_charcode().o == ["ㅎ", "a", " ", "A"]
Ejemplo n.º 2
0
def test_xpath():
    assert (Chepy("tests/files/test.html").load_file().xpath_selector(
        "//title/text()").get_by_index(0).o == "Example Domain")
Ejemplo n.º 3
0
def test_css():
    assert (Chepy("http://example.com").http_request().css_selector(
        "title").get_by_index(0).o == "<title>Example Domain</title>")
Ejemplo n.º 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")
Ejemplo n.º 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)
Ejemplo n.º 6
0
def test_base58_decode():
    assert Chepy(
        "2UDrs31qcWSPi").base58_decode().output.decode() == "some data"
Ejemplo n.º 7
0
def test_base32_encode():
    assert Chepy(
        "some data").base32_encode().output.decode() == "ONXW2ZJAMRQXIYI="
Ejemplo n.º 8
0
def test_from_octral():
    assert Chepy(["141", "142", "30516"]).from_octal().o == ["a", "b", "ㅎ"]
Ejemplo n.º 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;")
Ejemplo n.º 10
0
def test_from_binary():
    assert Chepy(["01100001", "01100010", "01100011"]).from_binary().o == [
        "a",
        "b",
        "c",
    ]
Ejemplo n.º 11
0
def test_to_octal():
    assert Chepy("abㅎ").to_octal().o == ["141", "142", "30516"]
Ejemplo n.º 12
0
def test_to_binary():
    assert Chepy("abc").to_binary().o == ["01100001", "01100010", "01100011"]
Ejemplo n.º 13
0
def test_from_decimal():
    assert Chepy([12622]).from_decimal().o == ["ㅎ"]
Ejemplo n.º 14
0
def test_to_decimal():
    assert Chepy("aㅎ").to_decimal().o == [97, 12622]
Ejemplo n.º 15
0
def test_trim():
    assert Chepy("\nlol ").trim().o == "lol"
Ejemplo n.º 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"')
Ejemplo n.º 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]}')
Ejemplo n.º 18
0
def test_from_punycode():
    assert Chepy(b"mnchen-3ya").from_punycode().o == "münchen"
Ejemplo n.º 19
0
def test_base85_decode():
    assert Chepy("F)Po,+Cno&@/").base85_decode().output.decode() == "some data"
Ejemplo n.º 20
0
def test_to_punycode():
    assert Chepy("münchen").to_punycode().o == b"mnchen-3ya"
Ejemplo n.º 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=")
Ejemplo n.º 22
0
def test_encode_bruteforce():
    assert (Chepy("münchen한").encode_bruteforce().get_by_key("ascii").o ==
            b"m\\xfcnchen\\ud55c")
Ejemplo n.º 23
0
def test_extract_email():
    assert (len(
        Chepy("tests/files/test.der").load_file().extract_email(
            is_binary=True).o) == 2)
Ejemplo n.º 24
0
def test_decode_bruteforce():
    assert (Chepy("m\xfcnchen\ud55c").decode_bruteforce().get_by_key("utf_8").o
            == "münchen한")
Ejemplo n.º 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)
Ejemplo n.º 26
0
def test_to_braille():
    assert Chepy("secret message").to_braille().o == "⠎⠑⠉⠗⠑⠞⠀⠍⠑⠎⠎⠁⠛⠑"
Ejemplo n.º 27
0
def test_extract_strings():
    assert len(
        Chepy("tests/files/hello").load_file().extract_strings().o) == 29
Ejemplo n.º 28
0
def test_from_braille():
    assert Chepy("⠎⠑⠉⠗⠑⠞⠀⠍⠑⠎⠎⠁⠛⠑").from_braille().o == "secret message"
Ejemplo n.º 29
0
def test_jpath():
    assert (Chepy("tests/files/test.json").load_file().jpath_selector(
        "[*].name.first").get_by_index(2).o == "Long")
Ejemplo n.º 30
0
def test_to_charcode():
    assert Chepy("aㅎ").to_charcode().o == ["61", "314e"]