Skip to content
New issue

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

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

Already on GitHub? # to your account

Testing Gmp #16

Merged
merged 10 commits into from
Nov 6, 2018
Merged

Testing Gmp #16

merged 10 commits into from
Nov 6, 2018

Conversation

bjoernricks
Copy link
Contributor

First test for testing Gmp class instead of the GmpCommandFactory

With this class it is possible to mock functions and methods. It can be
used easily as a decorator.

Simple and stupid example:

```python3
func = CallableMock()
func.return_value('foo')

self.assertEqual(func('bar'), 'foo')

func.has_been_called()
func.has_been_called_with('bar')

```
This class can be used to mock connections for testing.
The GmpCommandFactory shouldn't be tested. It's only a implementation
detail. With this changes the data send over the connection is tested
now.
@bjoernricks bjoernricks requested review from wiegandm and a team November 5, 2018 13:41
@codecov
Copy link

codecov bot commented Nov 5, 2018

Codecov Report

Merging #16 into master will increase coverage by 8.03%.
The diff coverage is 92.3%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #16      +/-   ##
==========================================
+ Coverage   14.73%   22.76%   +8.03%     
==========================================
  Files           9        9              
  Lines        2029     2029              
==========================================
+ Hits          299      462     +163     
+ Misses       1730     1567     -163
Impacted Files Coverage Δ
gvm/xml.py 18.51% <ø> (-1.04%) ⬇️
gvm/errors.py 100% <100%> (ø) ⬆️
gvm/protocols/base.py 86.84% <100%> (+86.84%) ⬆️
gvm/protocols/gmpv7.py 38.12% <90.9%> (+38.12%) ⬆️

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 588baaa...edc3640. Read the comment docs.

Make it easier to use XmlCommands inside of GvmProtocol implementations.
The class will be used if an invalid argument/parameter is passed to
some command.
Also adjust the possible filter types. This may break outside usage e.g.
passing "Port List" isn't possible anymore. It must contain an
underscore now. It shouldn't have been possible before to use those
types but maybe we have to allow them in future again.
wiegandm
wiegandm previously approved these changes Nov 6, 2018
@bjoernricks bjoernricks requested a review from wiegandm November 6, 2018 08:30
@bjoernricks bjoernricks merged commit 8a6f81f into greenbone:master Nov 6, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants