Skip to content

Commit

Permalink
Update qcs tests to reflect API changes
Browse files Browse the repository at this point in the history
ssh_port is now port for Sources and Scans now take a list of sources.
  • Loading branch information
kdelee committed Dec 18, 2017
1 parent b05d5e6 commit 2fb02e3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions camayoc/qcs_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,20 +253,20 @@ def __init__(
client=None,
name=None,
hosts=None,
ssh_port=22,
port=22,
credential_ids=None,
source_type=None,
_id=None):
"""Iniitalize a Source object with given data.
If no ssh_port is supplied, it will be set to 22 by default.
If no port is supplied, it will be set to 22 by default.
A uuid4 name and api.Client are also supplied if none are provided.
"""
super().__init__(client=client, _id=_id)
self.name = str(uuid.uuid4()) if name is None else name
self.endpoint = QCS_SOURCE_PATH
self.hosts = hosts
self.ssh_port = ssh_port
self.port = port
self.credentials = credential_ids
self.source_type = source_type

Expand Down Expand Up @@ -325,7 +325,7 @@ class Scan(QCSObject):
credential_ids=[cred._id]
)
>>> src.create()
>>> scan = Scan(source_id=src._id)
>>> scan = Scan(source_ids=[src._id])
>>> scan.create()
>>> scan.pause()
>>> assert scan.status() == 'paused'
Expand All @@ -334,9 +334,9 @@ class Scan(QCSObject):
def __init__(
self,
client=None,
source_id=None,
source_ids=None,
max_concurrency=50,
scan_type='host',
scan_type='inspect',
_id=None):
"""Iniitalize a Scan object with given data.
Expand All @@ -348,12 +348,12 @@ def __init__(
"""
super().__init__(client=client, _id=_id)

self.source = source_id
self.sources = source_ids
self.endpoint = QCS_SCAN_PATH

# valid scan types are 'host' and 'discovery'
self.scan_type = scan_type
self.max_concurrency = max_concurrency
self.options = {'max_concurrency': max_concurrency}

def delete(self):
"""No delete method is implemented for scan objects.
Expand Down
2 changes: 1 addition & 1 deletion camayoc/tests/qcs/test_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def test_create(shared_client, cleanup, source, isolated_filesystem):
)
netsrc.create()
cleanup.append(netsrc)
scan = Scan(source_id=netsrc._id)
scan = Scan(source_ids=[netsrc._id])
scan.create()
wait_until_complete(scan)
assert scan.status() == 'completed'
Expand Down
2 changes: 1 addition & 1 deletion tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
'id': 25,
'source_type': 'network',
'name': 'e193081c-2423-4407-b9e2-05d20b6443dc',
'ssh_port': 22
'port': 22
}


Expand Down

0 comments on commit 2fb02e3

Please sign in to comment.