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

Tests: missing mock for attribute deletion #127

Closed
sebix opened this issue Oct 26, 2017 · 1 comment
Closed

Tests: missing mock for attribute deletion #127

sebix opened this issue Oct 26, 2017 · 1 comment

Comments

@sebix
Copy link
Contributor

sebix commented Oct 26, 2017

I get this error when running the tests locally (python3 setup.py test outside and inside a build environment):

> python3 setup.py test
running test
Searching for requests-mock
Reading https://pypi.python.org/simple/requests-mock/
Downloading https://pypi.python.org/packages/8d/cb/1267d7294d97e9a3ef24bf1370791da4d2dc6abc0f67626f38f4bf25dfa3/requests-mock-1.3.0.tar.gz#md5=d2efbaf16d19153b7d271628071b4d4b
Best match: requests-mock 1.3.0
Processing requests-mock-1.3.0.tar.gz
Writing /tmp/easy_install-jfyygooo/requests-mock-1.3.0/setup.cfg
Running requests-mock-1.3.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-jfyygooo/requests-mock-1.3.0/egg-dist-tmp-sxdqv22j
creating /home/ele/develop/packaging/devel:languages:python/python-pymisp/pymisp-2.4.81.2/.eggs/requests_mock-1.3.0-py3.6.egg
Extracting requests_mock-1.3.0-py3.6.egg to /home/ele/develop/packaging/devel:languages:python/python-pymisp/pymisp-2.4.81.2/.eggs

Installed /home/ele/develop/packaging/devel:languages:python/python-pymisp/pymisp-2.4.81.2/.eggs/requests_mock-1.3.0-py3.6.egg
Searching for python-magic
Reading https://pypi.python.org/simple/python-magic/
Downloading https://pypi.python.org/packages/65/0b/c6b31f686420420b5a16b24a722fe980724b28d76f65601c9bc324f08d02/python-magic-0.4.13.tar.gz#md5=bbf309c8eeb414ed9957aa3a5e43a869
Best match: python-magic 0.4.13
Processing python-magic-0.4.13.tar.gz
Writing /tmp/easy_install-8wsjmu97/python-magic-0.4.13/setup.cfg
Running python-magic-0.4.13/setup.py -q bdist_egg --dist-dir /tmp/easy_install-8wsjmu97/python-magic-0.4.13/egg-dist-tmp-ogmrf50a
zip_safe flag not set; analyzing archive contents...
Moving python_magic-0.4.13-py3.6.egg to /home/ele/develop/packaging/devel:languages:python/python-pymisp/pymisp-2.4.81.2/.eggs

Installed /home/ele/develop/packaging/devel:languages:python/python-pymisp/pymisp-2.4.81.2/.eggs/python_magic-0.4.13-py3.6.egg
running egg_info
writing pymisp.egg-info/PKG-INFO
writing dependency_links to pymisp.egg-info/dependency_links.txt
writing requirements to pymisp.egg-info/requires.txt
writing top-level names to pymisp.egg-info/top_level.txt
reading manifest file 'pymisp.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'pymisp.egg-info/SOURCES.txt'
running build_ext
test_addAttributes (tests.test_offline.TestOffline) ... The version of PyMISP recommended by the MISP instance (2.4.62) is older than the one you're using now (2.4.81.2). Please upgrade the MISP instance or use an older PyMISP version.
ok
test_auth_error (tests.test_offline.TestOffline) ... The version of PyMISP recommended by the MISP instance (2.4.62) is older than the one you're using now (2.4.81.2). Please upgrade the MISP instance or use an older PyMISP version.
ok
test_deleteAttribute (tests.test_offline.TestOffline) ... The version of PyMISP recommended by the MISP instance (2.4.62) is older than the one you're using now (2.4.81.2). Please upgrade the MISP instance or use an older PyMISP version.
ERROR
test_deleteEvent (tests.test_offline.TestOffline) ... The version of PyMISP recommended by the MISP instance (2.4.62) is older than the one you're using now (2.4.81.2). Please upgrade the MISP instance or use an older PyMISP version.
ok
test_eventObject (tests.test_offline.TestOffline) ... The version of PyMISP recommended by the MISP instance (2.4.62) is older than the one you're using now (2.4.81.2). Please upgrade the MISP instance or use an older PyMISP version.
ok
test_getEvent (tests.test_offline.TestOffline) ... The version of PyMISP recommended by the MISP instance (2.4.62) is older than the one you're using now (2.4.81.2). Please upgrade the MISP instance or use an older PyMISP version.
ok
test_getSharingGroups (tests.test_offline.TestOffline) ... The version of PyMISP recommended by the MISP instance (2.4.62) is older than the one you're using now (2.4.81.2). Please upgrade the MISP instance or use an older PyMISP version.
ok
test_getVersions (tests.test_offline.TestOffline) ... The version of PyMISP recommended by the MISP instance (2.4.62) is older than the one you're using now (2.4.81.2). Please upgrade the MISP instance or use an older PyMISP version.
ok
test_newEvent (tests.test_offline.TestOffline) ... The version of PyMISP recommended by the MISP instance (2.4.62) is older than the one you're using now (2.4.81.2). Please upgrade the MISP instance or use an older PyMISP version.
ok
test_objects (tests.test_offline.TestOffline) ... /home/ele/develop/packaging/devel:languages:python/python-pymisp/pymisp-2.4.81.2/pymisp/tools/fileobject.py:30: UserWarning: Please install pydeep: pip install git+https://github.com/kbandla/pydeep.git
  warnings.warn("Please install pydeep: pip install git+https://github.com/kbandla/pydeep.git")
/home/ele/develop/packaging/devel:languages:python/python-pymisp/pymisp-2.4.81.2/pymisp/tools/fileobject.py:32: UserWarning: Please install python-magic: pip install python-magic.
  warnings.warn("Please install python-magic: pip install python-magic.")
ok
test_searchIndexByTagId (tests.test_offline.TestOffline) ... The version of PyMISP recommended by the MISP instance (2.4.62) is older than the one you're using now (2.4.81.2). Please upgrade the MISP instance or use an older PyMISP version.
ok
test_searchIndexByTagName (tests.test_offline.TestOffline) ... The version of PyMISP recommended by the MISP instance (2.4.62) is older than the one you're using now (2.4.81.2). Please upgrade the MISP instance or use an older PyMISP version.
ok
test_updateEvent (tests.test_offline.TestOffline) ... The version of PyMISP recommended by the MISP instance (2.4.62) is older than the one you're using now (2.4.81.2). Please upgrade the MISP instance or use an older PyMISP version.
ok

======================================================================
ERROR: test_deleteAttribute (tests.test_offline.TestOffline)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ele/develop/packaging/devel:languages:python/python-pymisp/pymisp-2.4.81.2/.eggs/requests_mock-1.3.0-py3.6.egg/requests_mock/mocker.py", line 219, in inner
    return func(*args, **kwargs)
  File "/home/ele/develop/packaging/devel:languages:python/python-pymisp/pymisp-2.4.81.2/tests/test_offline.py", line 82, in test_deleteAttribute
    d = pymisp.delete_attribute(2)
  File "/home/ele/develop/packaging/devel:languages:python/python-pymisp/pymisp-2.4.81.2/pymisp/api.py", line 370, in delete_attribute
    response = session.get(url)
  File "/usr/lib/python3.6/site-packages/requests/sessions.py", line 521, in get
    return self.request('GET', url, **kwargs)
  File "/usr/lib/python3.6/site-packages/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/ele/develop/packaging/devel:languages:python/python-pymisp/pymisp-2.4.81.2/.eggs/requests_mock-1.3.0-py3.6.egg/requests_mock/mocker.py", line 101, in _fake_send
    return _original_send(session, request, **kwargs)
  File "/usr/lib/python3.6/site-packages/requests/sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "/home/ele/develop/packaging/devel:languages:python/python-pymisp/pymisp-2.4.81.2/.eggs/requests_mock-1.3.0-py3.6.egg/requests_mock/adapter.py", line 233, in send
    raise exceptions.NoMockAddress(request)
requests_mock.exceptions.NoMockAddress: No mock address: GET http://misp.local/attributes/delete/2

----------------------------------------------------------------------
Ran 13 tests in 0.195s

FAILED (errors=1)
Test failed: <unittest.runner.TextTestResult run=13 errors=1 failures=0>
error: Test failed: <unittest.runner.TextTestResult run=13 errors=1 failures=0>

The mocks in initURI do not have this URI.

@Rafiot
Copy link
Member

Rafiot commented Oct 26, 2017

The test was fixed in this commit: a8daa9b

I'll release a new version of PyMISP later today.

@Rafiot Rafiot closed this as completed Oct 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants