diff --git a/scripting/tests/data/bad.csv b/scripting/tests/data/bad.csv deleted file mode 100644 index d29a9312a387186beb8bf4f77a8ec0e4b0ab80fa..0000000000000000000000000000000000000000 Binary files a/scripting/tests/data/bad.csv and /dev/null differ diff --git a/scripting/tests/data/bad.tsv b/scripting/tests/data/bad.tsv deleted file mode 100644 index d29a9312a387186beb8bf4f77a8ec0e4b0ab80fa..0000000000000000000000000000000000000000 Binary files a/scripting/tests/data/bad.tsv and /dev/null differ diff --git a/scripting/tests/data/bad.xls b/scripting/tests/data/bad.xls deleted file mode 100644 index 1f31bf2754258e3d07f88fd1e6bdee4d7b11bee1..0000000000000000000000000000000000000000 Binary files a/scripting/tests/data/bad.xls and /dev/null differ diff --git a/scripting/tests/data/bad.xlsx b/scripting/tests/data/bad.xlsx deleted file mode 100644 index 1f31bf2754258e3d07f88fd1e6bdee4d7b11bee1..0000000000000000000000000000000000000000 Binary files a/scripting/tests/data/bad.xlsx and /dev/null differ diff --git a/scripting/tests/data/server_error.csv b/scripting/tests/data/server_error.csv deleted file mode 100644 index 3e770df012f65d73ce4721a5f65d7e3f39959519..0000000000000000000000000000000000000000 --- a/scripting/tests/data/server_error.csv +++ /dev/null @@ -1 +0,0 @@ -Hi, this line contains a unicode backspace. This causes a server error, when pandas_table_preview.py's output is serialized into XML. \ No newline at end of file diff --git a/scripting/tests/data/test.csv b/scripting/tests/data/test.csv deleted file mode 100644 index 7c9bfd1354393439f551021cfe340577433ce2aa..0000000000000000000000000000000000000000 --- a/scripting/tests/data/test.csv +++ /dev/null @@ -1,12 +0,0 @@ -# test header -# two lines -A1,B1,C1,D1,E1,F1,G1,H1,I1,J1,K1,L1,M1,N1,O1,P1,Q1,R1,S1,T1 -A2,B2,C2,D2,E2,F2,G2,H2,I2,J2,K2,L2,M2,N2,O2,P2,Q2,R2,S2,T2 -A3,B3,csvfile,D3,E3,F3,G3,H3,I3,J3,K3,L3,M3,N3,O3,P3,Q3,R3,S3,T3 -A5,B5,C5,D5,E5,F5,G5,H5,I5,J5,K5,L5,M5,N5,O5,P5,Q5,R5,S5,T5 -A6,B6,C6,D6,E6,F6,G6,H6,I6,J6,K6,L6,M6,N6,O6,P6,Q6,R6,S6,T6 -A7,B7,csvfile,D7,E7,F7,G7,H7,I7,J7,K7,L7,M7,N7,O7,P7,Q7,R7,S7,T7 -A8,B8,C8,D8,E8,F8,G8,H8,I8,J8,K8,L8,M8,N8,O8,P8,Q8,R8,S8,T8 -A9,B9,C9,D9,E9,F9,G9,H9,I9,J9,K9,L9,M9,N9,O9,P9,Q9,R9,S9,T9 -A10,B10,C10,D10,E10,F10,G10,H10,I10,J10,K10,L10,M10,N10,O10,P10,Q10,R10,S10,T10 -A11,B11,C11,D11,E11,F11,G11,H11,I11,J11,K11,L11,M11,N11,O11,P11,Q11,R11,S11,T11 diff --git a/scripting/tests/data/test.tsv b/scripting/tests/data/test.tsv deleted file mode 100644 index 863f692bf64e7dcabf74703587a93e37adf27e67..0000000000000000000000000000000000000000 --- a/scripting/tests/data/test.tsv +++ /dev/null @@ -1,12 +0,0 @@ -# test header -# two lines -A1 B1 C1 D1 E1 F1 G1 H1 I1 J1 K1 L1 M1 N1 O1 P1 Q1 R1 S1 T1 -A2 B2 C2 D2 E2 F2 G2 H2 I2 J2 K2 L2 M2 N2 O2 P2 Q2 R2 S2 T2 -A3 B3 csvfile D3 E3 F3 G3 H3 I3 J3 K3 L3 M3 N3 O3 P3 Q3 R3 S3 T3 -A5 B5 C5 D5 E5 F5 G5 H5 I5 J5 K5 L5 M5 N5 O5 P5 Q5 R5 S5 T5 -A6 B6 C6 D6 E6 F6 G6 H6 I6 J6 K6 L6 M6 N6 O6 P6 Q6 R6 S6 T6 -A7 B7 tsvfile D7 E7 F7 G7 H7 I7 J7 K7 L7 M7 N7 O7 P7 Q7 R7 S7 T7 -A8 B8 C8 D8 E8 F8 G8 H8 I8 J8 K8 L8 M8 N8 O8 P8 Q8 R8 S8 T8 -A9 B9 C9 D9 E9 F9 G9 H9 I9 J9 K9 L9 M9 N9 O9 P9 Q9 R9 S9 T9 -A10 B10 C10 D10 E10 F10 G10 H10 I10 J10 K10 L10 M10 N10 O10 P10 Q10 R10 S10 T10 -A11 B11 C11 D11 E11 F11 G11 H11 I11 J11 K11 L11 M11 N11 O11 P11 Q11 R11 S11 T11 diff --git a/scripting/tests/data/test.xls b/scripting/tests/data/test.xls deleted file mode 100644 index a355756b9ab72f9035246c5303800a2076d9bfc0..0000000000000000000000000000000000000000 Binary files a/scripting/tests/data/test.xls and /dev/null differ diff --git a/scripting/tests/data/test.xlsx b/scripting/tests/data/test.xlsx deleted file mode 100644 index bc291f1aa86cd6d550320f07a7ce69cf813b8116..0000000000000000000000000000000000000000 Binary files a/scripting/tests/data/test.xlsx and /dev/null differ diff --git a/scripting/tests/data/xss_attack.csv b/scripting/tests/data/xss_attack.csv deleted file mode 100644 index e7d43505aef42c397f1859805bc87aab8b6da1a2..0000000000000000000000000000000000000000 --- a/scripting/tests/data/xss_attack.csv +++ /dev/null @@ -1,8 +0,0 @@ -# as it seems all these characters are escaped correctly. -"","%3C","<","<","<","<","<","<","<","<" -"<","<","<","<","<","<","<","<","<","<" -"<","<","<","<","<","<","<","<","<","<" -"<","<","<","<","<","<","<","<","<","<" -"<","<","<","<","<","<","<","<","<","<" -"<","<","<","<","<","<","<","<","<","<" -"<","<","<","<","<","<","\x3c","\x3C","\u003c","\u003C" diff --git a/scripting/tests/requirements.txt b/scripting/tests/requirements.txt deleted file mode 100644 index 4628529ba9dce50a08d574e21d3b4a71b50af2b1..0000000000000000000000000000000000000000 --- a/scripting/tests/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -caosdb -caosadvancedtools -pandas diff --git a/scripting/tests/test_pandas_table_preview.py b/scripting/tests/test_pandas_table_preview.py deleted file mode 100644 index 00d1c7f38746abe437abc76cd51b29600adcd049..0000000000000000000000000000000000000000 --- a/scripting/tests/test_pandas_table_preview.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env python3 -# encoding: utf-8 -# -# ** header v3.0 -# This file is a part of the CaosDB Project. -# -# Copyright (C) 2020 IndiScale GmbH <info@indiscale.com> -# Copyright (C) 2020 Henrik tom Wörden <h.tomwoerden@indiscale.com> -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero 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 Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see <https://www.gnu.org/licenses/>. -# -# ** end header -# - -import os -import unittest - -import caosdb as db -from caosdb.common.models import _parse_single_xml_element -from lxml import etree -from pandas_table_preview import (MAXIMUMFILESIZE, create_table_preview, - ending_is_valid, read_file, size_is_ok) - - -class PreviewTest(unittest.TestCase): - def test_file_ending(self): - self.assertFalse(ending_is_valid("/this/is/no/xls.lol")) - self.assertFalse(ending_is_valid("xls.lol")) - self.assertFalse(ending_is_valid("ag.xls.lol")) - assert ending_is_valid("/this/is/a/lol.xls") - assert ending_is_valid("/this/is/a/lol.csv") - assert ending_is_valid("/this/is/a/lol.cSv") - assert ending_is_valid("/this/is/a/lol.CSV") - assert ending_is_valid("lol.CSV") - - def test_file_size(self): - entity_xml = ('<File id="1234" name="SomeFile" ' - 'path="/this/path.tsv" size="{size}"></File>') - small = _parse_single_xml_element( - etree.fromstring(entity_xml.format(size="20000"))) - - assert size_is_ok(small) - large = _parse_single_xml_element( - etree.fromstring(entity_xml.format( - size=str(int(MAXIMUMFILESIZE+1))))) - assert not size_is_ok(large) - - def test_output(self): - files = [os.path.join(os.path.dirname(__file__), "data", f) - for f in ["test.csv", "test.tsv", "test.xls", "test.xlsx"]] - - for fi in files: - table = read_file(fi, ftype="."+fi.split(".")[-1]) - searchkey = fi.split(".")[-1]+"file" - print(table) - assert (table == searchkey).any(axis=None) - - badfiles = [os.path.join(os.path.dirname(__file__), "data", f) - for f in ["bad.csv", "bad.tsv", "bad.xls", "bad.xlsx"]] - - for bfi in badfiles: - self.assertRaises(ValueError, read_file, - bfi, "."+bfi.split(".")[-1])