Browse Source

moved tests to parent directory

tags/4.0.0
Kevin Froman 1 year ago
parent
commit
4f6f83f383
No known key found for this signature in database GPG Key ID: D414D0FE405B63B
17 changed files with 31 additions and 18 deletions
  1. +1
    -1
      .gitignore
  2. +1
    -1
      SECURITY.md
  3. +1
    -2
      run_tests.sh
  4. +2
    -1
      tests/test_blocks.py
  5. +2
    -1
      tests/test_commands.py
  6. +2
    -1
      tests/test_database_actions.py
  7. +2
    -1
      tests/test_default_config_json.py
  8. +2
    -1
      tests/test_forward_secrecy.py
  9. +2
    -1
      tests/test_getopenport.py
  10. +2
    -1
      tests/test_highlevelcrypto.py
  11. +2
    -1
      tests/test_identifyhome.py
  12. +2
    -1
      tests/test_keymanager.py
  13. +2
    -1
      tests/test_networkmerger.py
  14. +2
    -1
      tests/test_onionrusers.py
  15. +2
    -1
      tests/test_storagecounter.py
  16. +2
    -1
      tests/test_stringvalidations.py
  17. +2
    -1
      tests/test_zfill.py

+ 1
- 1
.gitignore View File

@@ -20,7 +20,7 @@ core
venv/*
onionr/fs*
onionr/tmp/*
testdata/*
*.dll
*.exe



+ 1
- 1
SECURITY.md View File

@@ -17,7 +17,7 @@ The following exploits are of particular interest:
* Discovering true server IPs when behind Tor/I2P (aside from Tor/i2p-level attacks)
* Easily discovering which nodes are the block creator
* XSS, CSRF, clickjacking, DNS rebinding
* Timing attacks against the local http server ([see blog post](https://www.chaoswebs.net/blog/timebleed-breaking-privacy-with-a-simple-timing-attack.html))
* Timing attacks against the local http server that are exploitable from a browser ([see blog post](https://www.chaoswebs.net/blog/timebleed-breaking-privacy-with-a-simple-timing-attack.html))
* Discovering direct connection servers as a non participant.
* Cryptography/protocol issues
* Denying nodes access to the network by segmenting them out with Sybil nodes


+ 1
- 2
run_tests.sh View File

@@ -1,5 +1,4 @@
#!/bin/bash
cd onionr;
rm -rf testdata;
mkdir testdata;
ran=0
@@ -14,4 +13,4 @@ for f in tests/*.py; do
python3 "$f" || close # if needed
let "ran++"
done
echo "ran $ran test files successfully in $SECONDS seconds"
echo "ran $ran test files successfully in $SECONDS seconds"

onionr/tests/test_blocks.py → tests/test_blocks.py View File

@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import sys, os
sys.path.append(".")
sys.path.append("onionr/")
import unittest, uuid, hashlib

import onionrblocks
@@ -30,4 +31,4 @@ class OnionrBlockTests(unittest.TestCase):
bl = onionrblocks.insert(message, asymPeer=onionrcrypto.pub_key)
self.assertIn(bytesconverter.str_to_bytes(message), onionrblockapi.Block(bl, decrypt=True).bcontent)

unittest.main()
unittest.main()

onionr/tests/test_commands.py → tests/test_commands.py View File

@@ -1,6 +1,7 @@
from unittest.mock import patch
import sys, os
sys.path.append(".")
sys.path.append("onionr/")
import unittest, uuid
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
print("Test directory:", TEST_DIR)
@@ -16,4 +17,4 @@ class OnionrTests(unittest.TestCase):
with patch.object(sys, 'argv', testargs):
parser.register()

unittest.main()
unittest.main()

onionr/tests/test_database_actions.py → tests/test_database_actions.py View File

@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import sys, os
sys.path.append(".")
sys.path.append("onionr/")
import unittest, uuid, sqlite3
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
print("Test directory:", TEST_DIR)
@@ -36,4 +37,4 @@ class OnionrTests(unittest.TestCase):
keydb.transportinfo.set_address_info(adder, 'success', 1000)
self.assertEqual(keydb.transportinfo.get_address_info(adder, 'success'), 1000)

unittest.main()
unittest.main()

onionr/tests/test_default_config_json.py → tests/test_default_config_json.py View File

@@ -1,5 +1,6 @@
import sys, os
sys.path.append(".")
sys.path.append("onionr/")
import unittest, uuid, json
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
print("Test directory:", TEST_DIR)
@@ -18,4 +19,4 @@ class OnionrConfig(unittest.TestCase):
with open(TEST_DIR + 'config.json') as conf:
json.loads(conf.read())

unittest.main()
unittest.main()

onionr/tests/test_forward_secrecy.py → tests/test_forward_secrecy.py View File

@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import sys, os, random
sys.path.append(".")
sys.path.append("onionr/")
import unittest, uuid
TEST_DIR_1 = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
TEST_DIR_2 = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
@@ -40,4 +41,4 @@ class OnionrForwardSecrecyTests(unittest.TestCase):
self.assertEqual(decrypted, message.encode())
return

unittest.main()
unittest.main()

onionr/tests/test_getopenport.py → tests/test_getopenport.py View File

@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import sys, os
sys.path.append(".")
sys.path.append("onionr/")
import unittest, uuid

TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
@@ -13,4 +14,4 @@ class GetOpenPortTest(unittest.TestCase):
open_port = int(netcontroller.get_open_port())
self.assertGreaterEqual(open_port, 1024)

unittest.main()
unittest.main()

onionr/tests/test_highlevelcrypto.py → tests/test_highlevelcrypto.py View File

@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import sys, os
sys.path.append(".")
sys.path.append("onionr/")
import unittest, uuid, hashlib, base64
import nacl.exceptions
import nacl.signing, nacl.hash, nacl.encoding
@@ -118,4 +119,4 @@ class OnionrCryptoTests(unittest.TestCase):
self.assertTrue(gen1 == gen2)
self.assertTrue(stringvalidators.validate_pub_key(gen1[0]))

unittest.main()
unittest.main()

onionr/tests/test_identifyhome.py → tests/test_identifyhome.py View File

@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import sys, os
sys.path.append(".")
sys.path.append("onionr/")
import unittest, uuid
from utils import identifyhome

@@ -12,4 +13,4 @@ class IdentifyHomeTest(unittest.TestCase):
os.environ["ONIONR_HOME"] = "testhome"
self.assertEqual(os.getcwd() + "/testhome/", identifyhome.identify_home())

unittest.main()
unittest.main()

onionr/tests/test_keymanager.py → tests/test_keymanager.py View File

@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import sys, os
sys.path.append(".")
sys.path.append("onionr/")
import unittest, uuid

TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
@@ -35,4 +36,4 @@ class KeyManagerTest(unittest.TestCase):
with open(filepaths.keys_file, 'r') as keyfile:
self.assertNotIn(new_key, keyfile.read())
unittest.main()
unittest.main()

onionr/tests/test_networkmerger.py → tests/test_networkmerger.py View File

@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import sys, os
sys.path.append(".")
sys.path.append("onionr/")
import unittest, uuid

TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
@@ -28,4 +29,4 @@ class NetworkMergerTest(unittest.TestCase):
for adder in adders:
self.assertNotIn(adder, added)

unittest.main()
unittest.main()

onionr/tests/test_onionrusers.py → tests/test_onionrusers.py View File

@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import sys, os
sys.path.append(".")
sys.path.append("onionr/")
import unittest, uuid
import json
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
@@ -89,4 +90,4 @@ class OnionrUserTests(unittest.TestCase):
else:
self.assertTrue(False)

unittest.main()
unittest.main()

onionr/tests/test_storagecounter.py → tests/test_storagecounter.py View File

@@ -1,5 +1,6 @@
import sys, os
sys.path.append(".")
sys.path.append("onionr/")
import unittest, uuid

TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
@@ -44,4 +45,4 @@ class TestStorageCounter(unittest.TestCase):
self.assertEqual(counter.get_amount(), start_value)

unittest.main()
unittest.main()

onionr/tests/test_stringvalidations.py → tests/test_stringvalidations.py View File

@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import sys, os
sys.path.append(".")
sys.path.append("onionr/")
import unittest, uuid
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
print("Test directory:", TEST_DIR)
@@ -68,4 +69,4 @@ class OnionrValidations(unittest.TestCase):
#print('testing', x)
self.assertFalse(stringvalidators.is_integer_string(x))
unittest.main()
unittest.main()

onionr/tests/test_zfill.py → tests/test_zfill.py View File

@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import unittest, sys
sys.path.append(".")
sys.path.append("onionr/")

from utils import reconstructhash

@@ -18,4 +19,4 @@ class ZFill_Hash(unittest.TestCase):
h = "0000e918d24999ad9b0ff00c1d414f36b74afc93871a0ece4bd452f82b56af87"
h_no = "e918d24999ad9b0ff00c1d414f36b74afc93871a0ece4bd452f82b56af87"
self.assertEqual(reconstructhash.deconstruct_hash(h), h_no)
unittest.main()
unittest.main()

Loading…
Cancel
Save