Skip to content

Commit

Permalink
'#1754: simplify test including extracted quotes in expected values
Browse files Browse the repository at this point in the history
  • Loading branch information
lfcnassif committed Jul 14, 2023
1 parent a2a09d9 commit f2f1076
Showing 1 changed file with 5 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,6 @@

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Dictionary;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;

import org.apache.tika.exception.TikaException;
import org.apache.tika.metadata.Metadata;
Expand All @@ -24,9 +10,8 @@
import org.junit.Test;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
import iped.properties.ExtraProperties;

import junit.framework.TestCase;
import static org.junit.Assert.*;

public class TorParserTest extends TestCase {

Expand All @@ -47,8 +32,8 @@ public void testTorParser1() throws IOException, SAXException, TikaException {
assertEquals(metadata.get(TorTcParser.TORTC_PURPOSE), "HS_CLIENT_REND");
assertEquals(metadata.get(TorTcParser.TORTC_REND_QUERY), "facebookwkhpilnemxj7asaniu7vnjjbiltxjqhye3mhbshg7kx5tfyd");
assertEquals(metadata.get(TorTcParser.TORTC_TIME_CREATED), "2023-07-03T17:05:24.214215Z");
assertEquals(metadata.get(TorTcParser.TORTC_SOCKS_USERNAME).substring(1,metadata.get(TorTcParser.TORTC_SOCKS_USERNAME).length()-1), "facebookwkhpilnemxj7asaniu7vnjjbiltxjqhye3mhbshg7kx5tfyd.onion");
assertEquals(metadata.get(TorTcParser.TORTC_SOCKS_PASSWORD).substring(1,metadata.get(TorTcParser.TORTC_SOCKS_PASSWORD).length()-2), "8b855a9b98c96ce9b877a17397d59945");
assertEquals(metadata.get(TorTcParser.TORTC_SOCKS_USERNAME), "\"facebookwkhpilnemxj7asaniu7vnjjbiltxjqhye3mhbshg7kx5tfyd.onion\"");
assertEquals(metadata.get(TorTcParser.TORTC_SOCKS_PASSWORD), "\"8b855a9b98c96ce9b877a17397d59945\"");
}
}

Expand All @@ -65,8 +50,8 @@ public void testTorParser2() throws IOException, SAXException, TikaException {
assertEquals(metadata.get(TorTcParser.TORTC_PURPOSE), "HS_CLIENT_REND");
assertEquals(metadata.get(TorTcParser.TORTC_REND_QUERY), "facebook26qderizo52pigg5y4a2jsdhqz4odvvusaij4yhxehqngqad");
assertEquals(metadata.get(TorTcParser.TORTC_TIME_CREATED), "2023-07-03T17:04:59.965391Z");
assertEquals(metadata.get(TorTcParser.TORTC_SOCKS_USERNAME).substring(1,metadata.get(TorTcParser.TORTC_SOCKS_USERNAME).length()-1), "facebookwkhpilnemxj7asaniu7vnjjbiltxjqhye3mhbshg7kx5tfyd.onion");
assertEquals(metadata.get(TorTcParser.TORTC_SOCKS_PASSWORD).substring(1,metadata.get(TorTcParser.TORTC_SOCKS_PASSWORD).length()-2), "8b855a9b98c96ce9b877a17397d59945");
assertEquals(metadata.get(TorTcParser.TORTC_SOCKS_USERNAME), "\"facebookwkhpilnemxj7asaniu7vnjjbiltxjqhye3mhbshg7kx5tfyd.onion\"");
assertEquals(metadata.get(TorTcParser.TORTC_SOCKS_PASSWORD), "\"8b855a9b98c96ce9b877a17397d59945\"");
}
}
}

0 comments on commit f2f1076

Please sign in to comment.