Skip to content
This repository has been archived by the owner on Nov 29, 2021. It is now read-only.

Move OSPDError and improve vts filter. #95

Merged
merged 4 commits into from
Mar 22, 2019

Conversation

jjnicola
Copy link
Member

  • Create module ospd.error and ospd.xml
    Move OSPDError class from ospd.ospd to its own module.
    Move simple_response_str() and get_result_xml() from ospd.ospd to its own module.
    This allows to import the modules from other files, avoiding an import loop.
    Update tests accordingly.

  • Improve the way in which the filter for vts is applied.

  • Add error handling to the filter passed to get_vts.

@jjnicola jjnicola requested review from bjoernricks and a team March 22, 2019 08:00
@codecov
Copy link

codecov bot commented Mar 22, 2019

Codecov Report

Merging #95 into master will increase coverage by 0.19%.
The diff coverage is 93.75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #95      +/-   ##
==========================================
+ Coverage   66.77%   66.97%   +0.19%     
==========================================
  Files           6        8       +2     
  Lines        1496     1511      +15     
==========================================
+ Hits          999     1012      +13     
- Misses        497      499       +2
Impacted Files Coverage Δ
ospd/ospd.py 66.16% <100%> (-0.87%) ⬇️
ospd/xml.py 100% <100%> (ø)
ospd/error.py 100% <100%> (ø)
ospd/vtfilter.py 80.85% <70%> (-2.08%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eafcd61...ec743fd. Read the comment docs.

ospd/error.py Outdated
client """

def __init__(self, message, command='osp', status=400):
super(OSPDError, self).__init__()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With python 3 you can just use

Suggested change
super(OSPDError, self).__init__()
super().__init__()

https://docs.python.org/3/library/functions.html#super

Copy link
Contributor

@bjoernricks bjoernricks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very useful! Just update the docstrings to our common format.

ospd/xml.py Outdated
def simple_response_str(command, status, status_text, content=""):
""" Creates an OSP response XML string.

@param: OSP Command to respond to.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use the same docstring annotations as before?

Arguments:
    name (type): ....

Move OSPDError class from ospd.ospd to its own module.
Move simple_response_str() and get_result_xml() from ospd.ospd to its own module.
This allows to import the modules from other files, avoiding an import loop.
Update tests accordingly.
@jjnicola jjnicola merged commit e62d3b9 into greenbone:master Mar 22, 2019
@jjnicola jjnicola deleted the ospd-error branch March 22, 2019 09:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants