Skip to content

Commit

Permalink
fixed tests and .env issue
Browse files Browse the repository at this point in the history
  • Loading branch information
FadyDev2 committed Jun 16, 2018
1 parent 303ad02 commit 6d3fa36
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
8 changes: 4 additions & 4 deletions dht/dht.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

load_dotenv(find_dotenv())

K_BUCKET_SIZE = int(os.getenv("K_BUCKET_SIZE"))
ALPHA = int(os.getenv("ALPHA"))
ID_BITS = int(os.getenv("ID_BITS"))
ITERATION_SLEEP = int(os.getenv("ITERATION_SLEEP"))
K_BUCKET_SIZE = 20 if os.getenv("K_BUCKET_SIZE") is None else int(os.getenv("K_BUCKET_SIZE"))
ALPHA = 3 if os.getenv("ALPHA") is None else int(os.getenv("ALPHA"))
ID_BITS = 128 if os.getenv("ID_BITS") is None else int(os.getenv("ID_BITS"))
ITERATION_SLEEP = 1 if os.getenv("ITERATION_SLEEP") is None else int(os.getenv("ITERATION_SLEEP"))


class DHT:
Expand Down
4 changes: 1 addition & 3 deletions tests/dht_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@

class DHTTest(unittest.TestCase):
def setUp(self):
from dotenv import load_dotenv, find_dotenv
env_path = Path('..') / '.env.dist'
load_dotenv(dotenv_path=env_path)
pass

def test_dht(self):
"""
Expand Down
11 changes: 4 additions & 7 deletions tests/peer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@

class PeerTest(unittest.TestCase):
def setUp(self):
from dotenv import load_dotenv
env_path = Path('..') / '.env.dist'
load_dotenv(dotenv_path=env_path)
pass


def test_peer(self):
peer = Peer("localhost", 9789, "foo", "bar")
self.assertEqual(str(peer), "localhost:9789")
def test_peer(self):
peer = Peer("localhost", 9789, "foo", "bar")
self.assertEqual(str(peer), "localhost:9789")

0 comments on commit 6d3fa36

Please sign in to comment.