[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [collector/master] Add tests for transport and transport-info lines.



commit bcaed1a44345f02300e3727cac734fcfd05f1cea
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Wed Sep 28 21:15:15 2016 +0200

    Add tests for transport and transport-info lines.
---
 .../bridgedescs/SanitizedBridgesWriterTest.java      | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/test/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriterTest.java b/src/test/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriterTest.java
index 424de8e..3548345 100644
--- a/src/test/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriterTest.java
+++ b/src/test/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriterTest.java
@@ -497,6 +497,26 @@ public class SanitizedBridgesWriterTest {
   }
 
   @Test
+  public void testExtraInfoDescriptorTransportSpace() throws Exception {
+    this.defaultExtraInfoDescriptorBuilder.replaceLineStartingWith(
+        "transport ", Arrays.asList("transport "));
+    this.runTest();
+    assertTrue("Sanitized extra-info descriptor with invalid transport "
+        + "line.", this.parsedExtraInfoDescriptors.isEmpty());
+  }
+
+  @Test
+  public void testExtraInfoDescriptorTransportInfoRemoved() throws Exception {
+    this.defaultExtraInfoDescriptorBuilder.insertBeforeLineStartingWith(
+        "bridge-stats-end ", Arrays.asList("transport-info secretkey"));
+    this.runTest();
+    for (String line : this.parsedExtraInfoDescriptors.get(0)) {
+      assertFalse("transport-info line should not have been retained.",
+          line.startsWith("transport-info "));
+    }
+  }
+
+  @Test
   public void testExtraInfoDescriptorRouterSignatureLineSpace()
       throws Exception {
     this.defaultExtraInfoDescriptorBuilder.replaceLineStartingWith(



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits