aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/data/pf014
-rw-r--r--test/test_platform_pf.py13
2 files changed, 17 insertions, 0 deletions
diff --git a/test/data/pf01 b/test/data/pf01
new file mode 100644
index 00000000..3139a289
--- /dev/null
+++ b/test/data/pf01
@@ -0,0 +1,4 @@
+No ALTQ support in kernel
+ALTQ related functions disabled
+ALL tcp 127.0.0.1:8080 <- 5.5.5.6:80 <- 192.168.1.111:40001 FIN_WAIT_2:FIN_WAIT_2
+ALL tcp 127.0.0.1:8080 <- 5.5.5.5:80 <- 192.168.1.111:40000 ESTABLISHED:ESTABLISHED
diff --git a/test/test_platform_pf.py b/test/test_platform_pf.py
new file mode 100644
index 00000000..a2e7c3c1
--- /dev/null
+++ b/test/test_platform_pf.py
@@ -0,0 +1,13 @@
+import tutils
+from libmproxy.platform import pf
+
+
+class TestLookup:
+ def test_simple(self):
+ p = tutils.test_data.path("data/pf01")
+ d = open(p).read()
+ assert pf.lookup("192.168.1.111", 40000, d) == ("5.5.5.5", 80)
+ assert not pf.lookup("192.168.1.112", 40000, d)
+ assert not pf.lookup("192.168.1.111", 40001, d)
+
+