Skip to content

Commit

Permalink
Merge pull request #74 from wiegandm/fix_get_credentials
Browse files Browse the repository at this point in the history
Fix get_credentials method
  • Loading branch information
bjoernricks authored Dec 10, 2018
2 parents 3b3f1e8 + 8aed657 commit 10f6cd4
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# python-gvm 1.0.0 (unreleased)

## gvm.protocols.gmpv7

* Fixed generating XML for `get_credentials` command

# python-gvm 1.0.0.beta2 (04.12.2018)

## gvm.protocols.base
Expand Down
2 changes: 1 addition & 1 deletion gvm/protocols/gmpv7.py
Original file line number Diff line number Diff line change
Expand Up @@ -2185,7 +2185,7 @@ def get_credentials(self, *, filter=None, filter_id=None, scanners=None,

cmd.set_attribute('format', format)

return self.send_command(cmd)
return self._send_xml_command(cmd)

def get_credential(self, credential_id):
"""Request a single credential
Expand Down
39 changes: 39 additions & 0 deletions tests/protocols/gmpv7/test_get_credentials.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2018 Greenbone Networks GmbH
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import unittest

from gvm.protocols.gmpv7 import Gmp

from .. import MockConnection

class GmpGetCredentialsTestCase(unittest.TestCase):

def setUp(self):
self.connection = MockConnection()
self.gmp = Gmp(self.connection)

def test_get_credentials_simple(self):
self.gmp.get_credentials()

self.connection.send.has_been_called_with(
'<get_credentials/>')


if __name__ == '__main__':
unittest.main()

0 comments on commit 10f6cd4

Please sign in to comment.