-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#5: some unit tests on base methods added
- Loading branch information
Timur Gilmullin
committed
Jul 11, 2017
1 parent
83dc8f9
commit 833b8e2
Showing
2 changed files
with
208 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import pysphere | ||
|
||
|
||
def pytest_sessionstart(session): | ||
|
||
class VMInstanceWrapper(object): | ||
|
||
def __init__(self, status='POWERED OFF'): | ||
self.status = status | ||
|
||
def get_status(self, *args, **kwargs): | ||
return self.status | ||
|
||
def power_on(self, *args, **kwargs): | ||
return 'TEST POWER ON' | ||
|
||
def power_off(self, *args, **kwargs): | ||
return 'TEST POWER OFF' | ||
|
||
def wait_for_tools(self, *args, **kwargs): | ||
return 'Waiting until OS started...' | ||
|
||
def get_properties(self, *args, **kwargs): | ||
return {'ip_address': '0.0.0.0', 'test': 123, 'testSub': {'subName': {'subSubName': 'qqq'}}} | ||
|
||
def get_current_snapshot_name(self, *args, **kwargs): | ||
return '' | ||
|
||
def get_snapshots(self, *args, **kwargs): | ||
return ['current snapshot', 'another snapshot'] | ||
|
||
def revert_to_snapshot(self, *args, **kwargs): | ||
return 'reverting to current snapshot...' | ||
|
||
def revert_to_named_snapshot(self, *args, **kwargs): | ||
return 'reverting to named snapshot...' | ||
|
||
def delete_named_snapshot(self, *args, **kwargs): | ||
return 'deleting named snapshot...' | ||
|
||
def create_snapshot(self, *args, **kwargs): | ||
return 'creating new snapshot...' | ||
|
||
def clone(self, *args, **kwargs): | ||
return 'cloning vm...' | ||
|
||
def login_in_guest(self, *args, **kwargs): | ||
return 'login in guest' | ||
|
||
def send_file(self, *args, **kwargs): | ||
return 'sending file...' | ||
|
||
def get_file(self, *args, **kwargs): | ||
return 'geting file...' | ||
|
||
def make_directory(self, *args, **kwargs): | ||
return 'making directory...' | ||
|
||
class VIServerWrapper(object): | ||
|
||
def connect(self, *args, **kwargs): | ||
return 'CONNECTED' | ||
|
||
def get_vm_by_name(self, *args, **kwargs): | ||
if 'FAKE' in args: | ||
raise Exception('No Name found for CloneVM test') | ||
|
||
else: | ||
return VMInstanceWrapper() | ||
|
||
def delete_vm_by_name(self, *args, **kwargs): | ||
return True, 'DELETED' | ||
|
||
pysphere.VIServer = VIServerWrapper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters