Marked use of random, subprocess and xmlrpclib in tests
for skipping by bandit
This commit is contained in:
parent
cfdb6beb54
commit
c8a781c7c5
|
@ -3,7 +3,7 @@ Tests for core and those that do not work outside
|
||||||
(because of import error for example)
|
(because of import error for example)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import random
|
import random # nosec
|
||||||
import string
|
import string
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
@ -17,10 +17,10 @@ class TestCore(unittest.TestCase):
|
||||||
"""test encoding and decoding (originally from helper_msgcoding)"""
|
"""test encoding and decoding (originally from helper_msgcoding)"""
|
||||||
msg_data = {
|
msg_data = {
|
||||||
'subject': ''.join(
|
'subject': ''.join(
|
||||||
random.choice(string.ascii_lowercase + string.digits)
|
random.choice(string.ascii_lowercase + string.digits) # nosec
|
||||||
for _ in range(40)),
|
for _ in range(40)),
|
||||||
'body': ''.join(
|
'body': ''.join(
|
||||||
random.choice(string.ascii_lowercase + string.digits)
|
random.choice(string.ascii_lowercase + string.digits) # nosec
|
||||||
for _ in range(10000))
|
for _ in range(10000))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ Tests using API.
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
import json
|
import json
|
||||||
import xmlrpclib
|
import xmlrpclib # nosec
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
from test_process import TestProcessProto
|
from test_process import TestProcessProto
|
||||||
|
|
|
@ -4,7 +4,7 @@ Common reusable code for tests and tests for pybitmessage process.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import signal
|
import signal
|
||||||
import subprocess
|
import subprocess # nosec
|
||||||
import tempfile
|
import tempfile
|
||||||
import time
|
import time
|
||||||
import unittest
|
import unittest
|
||||||
|
@ -34,7 +34,7 @@ class TestProcessProto(unittest.TestCase):
|
||||||
"""Setup environment and start pybitmessage"""
|
"""Setup environment and start pybitmessage"""
|
||||||
cls.home = os.environ['BITMESSAGE_HOME'] = tempfile.gettempdir()
|
cls.home = os.environ['BITMESSAGE_HOME'] = tempfile.gettempdir()
|
||||||
put_signal_file(cls.home, 'unittest.lock')
|
put_signal_file(cls.home, 'unittest.lock')
|
||||||
subprocess.call(cls._process_cmd)
|
subprocess.call(cls._process_cmd) # nosec
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
cls.pid = int(cls._get_readline('singleton.lock'))
|
cls.pid = int(cls._get_readline('singleton.lock'))
|
||||||
cls.process = psutil.Process(cls.pid)
|
cls.process = psutil.Process(cls.pid)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user