Skip to content

Commit

Permalink
bug fix (#330)
Browse files Browse the repository at this point in the history
Limit scope of test to prevent changes in tests running after it
  • Loading branch information
rjt-gupta authored and rnehra01 committed Jun 10, 2019
1 parent 18324ab commit 0e29aac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions tanner/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ def test_apply_filter_end_time_false(self):
def tearDown(self):

async def close():
await self.redis_client.flushall()
self.redis_client.close()
await self.redis_client.wait_closed()

Expand Down
8 changes: 5 additions & 3 deletions tanner/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
import os
import unittest

from unittest import mock
from tanner import config


class TestCongif(unittest.TestCase):
class TestConfig(unittest.TestCase):
def setUp(self):
config.TannerConfig.config = None
self.d = {
Expand All @@ -15,7 +16,7 @@ def setUp(self):
'WEB': {'host': '0.0.0.0', 'port': '9001'},
'API': {'host': '0.0.0.0', 'port': '9002'},
'PHPOX': {'host': '0.0.0.0', 'port': '8088'},
'REDIS': {'host': 'localhost', 'port': '1337', 'poolsize': '40', 'timeout': '5'},
'REDIS': {'host': 'localhost', 'port': '6379', 'poolsize': '80', 'timeout': '5'},
'EMULATORS': {'root_dir': '/opt/tanner'},
'EMULATOR_ENABLED': {'sqli': 'True', 'rfi': 'True', 'lfi': 'True', 'xss': 'True', 'cmd_exec': 'True'},
'SQLI': {'type': 'SQLITE', 'db_name': 'user_tanner_db', 'host': 'localhost', 'user': 'user_name',
Expand All @@ -41,7 +42,8 @@ def setUp(self):

self.invalid_config_path = '/random/random_name'

def test_set_config_when_file_exists(self):
@mock.patch('tanner.tests.test_config.config')
def test_set_config_when_file_exists(self, m):
config.TannerConfig.set_config(self.valid_config_path)
self.assertIsNotNone(config.TannerConfig.config)

Expand Down

0 comments on commit 0e29aac

Please # to comment.