59 lines
1.8 KiB
Python
59 lines
1.8 KiB
Python
|
# JTFTP - Python/AsyncIO TFTP Server
|
||
|
# Copyright (C) 2022 Jeffrey C. Ollie
|
||
|
#
|
||
|
# This program is free software: you can redistribute it and/or modify
|
||
|
# it under the terms of the GNU General Public License as published by
|
||
|
# the Free Software Foundation, either version 3 of the License, or
|
||
|
# (at your option) any later version.
|
||
|
#
|
||
|
# This program is distributed in the hope that it will be useful,
|
||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
# GNU General Public License for more details.
|
||
|
#
|
||
|
# You should have received a copy of the GNU General Public License
|
||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||
|
|
||
|
from jtftp.netascii import NetAsciiCR
|
||
|
from jtftp.netascii import NetAsciiLF
|
||
|
|
||
|
|
||
|
def test_from_netascii_cr_1():
|
||
|
assert NetAsciiCR.from_netascii(b"\x0d\x00") == b"\x0d"
|
||
|
|
||
|
|
||
|
def test_from_netascii_cr_1():
|
||
|
assert NetAsciiCR.from_netascii(b"\x0d\x0a") == b"\x0d"
|
||
|
|
||
|
|
||
|
def test_from_netascii_cr_2():
|
||
|
assert NetAsciiCR.from_netascii(b"foo\x0d\x0a\x0abar") == b"foo\x0d\x0abar"
|
||
|
|
||
|
|
||
|
def test_from_netascii_cr_3():
|
||
|
assert NetAsciiCR.from_netascii(b"foo\x0d\x00\x0abar") == b"foo\x0d\x0abar"
|
||
|
|
||
|
|
||
|
def test_from_netascii_cr_4():
|
||
|
assert NetAsciiCR.from_netascii(b"foo\x0d\x0a\x0dbar") == b"foo\x0d\x0dbar"
|
||
|
|
||
|
|
||
|
def test_from_netascii_lf_1():
|
||
|
assert NetAsciiLF.from_netascii(b"\x0d\x00") == b"\x0d"
|
||
|
|
||
|
|
||
|
def test_from_netascii_lf_1():
|
||
|
assert NetAsciiLF.from_netascii(b"\x0d\x0a") == b"\x0a"
|
||
|
|
||
|
|
||
|
def test_from_netascii_lf_2():
|
||
|
assert NetAsciiLF.from_netascii(b"foo\x0d\x0a\x0abar") == b"foo\x0a\x0abar"
|
||
|
|
||
|
|
||
|
def test_from_netascii_lf_3():
|
||
|
assert NetAsciiLF.from_netascii(b"foo\x0d\x00\x0abar") == b"foo\x0d\x0abar"
|
||
|
|
||
|
|
||
|
def test_from_netascii_lf_4():
|
||
|
assert NetAsciiLF.from_netascii(b"foo\x0d\x0a\x0dbar") == b"foo\x0a\x0dbar"
|