Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Models UnitTest Error. #347

Closed
Dhuck opened this issue Feb 28, 2020 · 3 comments
Closed

Models UnitTest Error. #347

Dhuck opened this issue Feb 28, 2020 · 3 comments

Comments

@Dhuck
Copy link

Dhuck commented Feb 28, 2020

Hi,

i'm trying to run unit test for "models" but I am receiving the following error.

$ python -m unittest tests/testModels.py
Traceback (most recent call last):
  File "/usr/lib64/python3.8/runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib64/python3.8/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/lib64/python3.8/unittest/__main__.py", line 18, in <module>
    main(module=None)
  File "/usr/lib64/python3.8/unittest/main.py", line 100, in __init__
    self.parseArgs(argv)
  File "/usr/lib64/python3.8/unittest/main.py", line 147, in parseArgs
    self.createTests()
  File "/usr/lib64/python3.8/unittest/main.py", line 158, in createTests
    self.test = self.testLoader.loadTestsFromNames(self.testNames,
  File "/usr/lib64/python3.8/unittest/loader.py", line 220, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/usr/lib64/python3.8/unittest/loader.py", line 220, in <listcomp>
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/usr/lib64/python3.8/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/home/vagrant/projects/RootTheBox/tests/testModels.py", line 9, in <module>
    from models import dbsession
  File "/home/vagrant/projects/RootTheBox/models/__init__.py", line 35, in <module>
    if options.log_sql:
  File "/home/vagrant/.local/share/virtualenvs/RootTheBox-hkgRnGAZ/lib/python3.8/site-packages/tornado/options.py", line 145, in __getattr__
    raise AttributeError("Unrecognized option %r" % name)
AttributeError: Unrecognized option 'log-sql'

I have the configuration file and I can to start RTB without problems.

$ cat files/rootthebox.cfg
[Database]
sql_dialect = "sqlite"
sql_database = "rootthebox"
sql_host = "127.0.0.1"
sql_port = 3306
sql_user = ""
sql_password = ""
log_sql = True

Can you help me please or is there another way to run it?

@Dhuck Dhuck changed the title Error with UnitTest. Models UnitTest Error. Feb 28, 2020
@eljeffeg
Copy link
Collaborator

Thanks for pointing this out. I'll work on exposing the unit tests via an run option, but there is still some work that needs to be done as these haven't been kept up and are not py3 tested.

@eljeffeg
Copy link
Collaborator

I pushed an update d9fe262 that exposes the unit tests to a command line argument. The Handler tests are not yet Python 3 compliant (still trying to figure out a callback issue), but it should work on Python 2, with the exception of 1 failure that still needs to be worked out. It's an issue with the unit test (likely memcached), not the app itself.

$ python rootthebox.py --tests

eljeffeg added a commit that referenced this issue Mar 3, 2020
@eljeffeg
Copy link
Collaborator

eljeffeg commented Mar 3, 2020

Updated the Handler tests for Py3 compatibility. We still have that one failure on the /login test, which I haven't figured out.

@eljeffeg eljeffeg mentioned this issue Aug 26, 2021
eljeffeg added a commit that referenced this issue Sep 23, 2021
Pagination on scoreboard / teams #449
Category Description #382
CyberChef 9.28.0
Moved notifications to menu icon
Public user profile when scoreboard public
Record User Flag Captures for Public User page stats
User account expire option
Addressed unit test error #347
Timer option to allow scoreboard visibility #452 , #174
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants