44
55import pytest
66
7+ from msa_sdk .conf_backup import ConfBackup
78from msa_sdk .conf_profile import ConfProfile
89from msa_sdk .customer import Customer
910from msa_sdk .device import Device
@@ -39,6 +40,7 @@ def device_info():
3940 '"logMoreEnabled":false,"mailAlerting":false,"reporting":false,'
4041 '"useNat":true,"snmpCommunity":""}' )
4142
43+
4244def device_list ():
4345 """
4446
@@ -49,37 +51,38 @@ def device_list():
4951 String: list of mocked device ids
5052
5153 """
52- return ('[{"prefix":"FST","id":130,"name":"BNG-1","sdType":{"id":0,"isObsolete":false,'
53- '"useWizard":true,"key":"SdType_1_113","manId":1,"manufacturer":"Cisco","model":"IOS",'
54- '"modId":113,"supportedProfiles":"NULL,DES,3DES","type":0,"familyId":0,"proxy":false,'
55- '"managed":true,"hasBeenDeleted":false,"utm":false,"reportMail":false,"reportFirewall":false,'
56- '"stringyfiedIdent":"CiscoIOS","typeHS":"H","name":"CiscoIOS"},"alertMail":true,"silver":false,'
57- '"gold":false,"report":false,"tamper":false,"ha":false,"dmz":false,"modelFromAsset":"CiscoIOSv",'
58- '"managed":true,"confProfile":false,"planningProfile":false,"externalReference":"FST130",'
59- '"groupId":0,"groupName":"","maintenanceMode":false,"modId":113,"manId":1,"customerId":6,'
60- '"monitorPflId":[],"haPeerId":null,"visibleName":"BNG-1-FST130","ubiId":"FST130",'
61- '"deviceId":{"id":130,"prefix":"FST","ubiId":"FST130","name":"BNG-1","externalReference":"FST130",'
62- '"operatorId":0,"displayName":"BNG-1-FST130","displayNameForJsps":"BNG-1-FST130","type":"","hostname":null},'
63- '"idAsLong":130,"pingStatus":"OK"},{"prefix":"FST","id":127,"name":"M2K-1","sdType":{"id":0,"isObsolete":false,'
64- '"useWizard":true,"key":"SdType_1_113","manId":1,"manufacturer":"Cisco","model":"IOS","modId":113,'
65- '"supportedProfiles":"NULL,DES,3DES","type":0,"familyId":0,"proxy":false,"managed":true,"hasBeenDeleted":false,'
66- '"utm":false,"reportMail":false,"reportFirewall":false,"stringyfiedIdent":"CiscoIOS","typeHS":"H",'
67- '"name":"CiscoIOS"},"alertMail":true,"silver":false,"gold":false,"report":false,"tamper":false,"ha":false,'
68- '"dmz":false,"modelFromAsset":"CiscoIOSv","managed":true,"confProfile":false,"planningProfile":false,'
69- '"externalReference":"FST127","groupId":0,"groupName":"","maintenanceMode":false,"modId":113,"manId":1,'
70- '"customerId":6,"monitorPflId":[],"haPeerId":null,"visibleName":"M2K-1-FST127","ubiId":"FST127",'
71- '"deviceId":{"id":127,"prefix":"FST","ubiId":"FST127","name":"M2K-1","externalReference":"FST127","operatorId":0,'
72- '"displayName":"M2K-1-FST127","displayNameForJsps":"M2K-1-FST127","type":"","hostname":null},"idAsLong":127,'
73- '"pingStatus":"OK"},{"prefix":"FST","id":125,"name":"M2K-2","sdType":{"id":0,"isObsolete":false,"useWizard":true,'
74- '"key":"SdType_1_113","manId":1,"manufacturer":"Cisco","model":"IOS","modId":113,"supportedProfiles":"NULL,DES,3DES",'
75- '"type":0,"familyId":0,"proxy":false,"managed":true,"hasBeenDeleted":false,"utm":false,"reportMail":false,'
76- '"reportFirewall":false,"stringyfiedIdent":"CiscoIOS","typeHS":"H","name":"CiscoIOS"},"alertMail":false,"silver":false,'
77- '"gold":false,"report":false,"tamper":false,"ha":false,"dmz":false,"modelFromAsset":"CiscoIOSv","managed":true,'
78- '"confProfile":false,"planningProfile":false,"externalReference":"FST125","groupId":0,"groupName":"",'
79- '"maintenanceMode":false,"modId":113,"manId":1,"customerId":6,"monitorPflId":[],"haPeerId":null,'
80- '"visibleName":"M2K-2-FST125","ubiId":"FST125","deviceId":{"id":125,"prefix":"FST","ubiId":"FST125",'
81- '"name":"M2K-2","externalReference":"FST125","operatorId":0,"displayName":"M2K-2-FST125",'
82- '"displayNameForJsps":"M2K-2-FST125","type":"","hostname":null},"idAsLong":125,"pingStatus":"OK"}]' )
54+ return (
55+ '[{"prefix":"FST","id":130,"name":"BNG-1","sdType":{"id":0,"isObsolete":false,'
56+ '"useWizard":true,"key":"SdType_1_113","manId":1,"manufacturer":"Cisco","model":"IOS",'
57+ '"modId":113,"supportedProfiles":"NULL,DES,3DES","type":0,"familyId":0,"proxy":false,'
58+ '"managed":true,"hasBeenDeleted":false,"utm":false,"reportMail":false,"reportFirewall":false,'
59+ '"stringyfiedIdent":"CiscoIOS","typeHS":"H","name":"CiscoIOS"},"alertMail":true,"silver":false,'
60+ '"gold":false,"report":false,"tamper":false,"ha":false,"dmz":false,"modelFromAsset":"CiscoIOSv",'
61+ '"managed":true,"confProfile":false,"planningProfile":false,"externalReference":"FST130",'
62+ '"groupId":0,"groupName":"","maintenanceMode":false,"modId":113,"manId":1,"customerId":6,'
63+ '"monitorPflId":[],"haPeerId":null,"visibleName":"BNG-1-FST130","ubiId":"FST130",'
64+ '"deviceId":{"id":130,"prefix":"FST","ubiId":"FST130","name":"BNG-1","externalReference":"FST130",'
65+ '"operatorId":0,"displayName":"BNG-1-FST130","displayNameForJsps":"BNG-1-FST130","type":"","hostname":null},'
66+ '"idAsLong":130,"pingStatus":"OK"},{"prefix":"FST","id":127,"name":"M2K-1","sdType":{"id":0,"isObsolete":false,'
67+ '"useWizard":true,"key":"SdType_1_113","manId":1,"manufacturer":"Cisco","model":"IOS","modId":113,'
68+ '"supportedProfiles":"NULL,DES,3DES","type":0,"familyId":0,"proxy":false,"managed":true,"hasBeenDeleted":false,'
69+ '"utm":false,"reportMail":false,"reportFirewall":false,"stringyfiedIdent":"CiscoIOS","typeHS":"H",'
70+ '"name":"CiscoIOS"},"alertMail":true,"silver":false,"gold":false,"report":false,"tamper":false,"ha":false,'
71+ '"dmz":false,"modelFromAsset":"CiscoIOSv","managed":true,"confProfile":false,"planningProfile":false,'
72+ '"externalReference":"FST127","groupId":0,"groupName":"","maintenanceMode":false,"modId":113,"manId":1,'
73+ '"customerId":6,"monitorPflId":[],"haPeerId":null,"visibleName":"M2K-1-FST127","ubiId":"FST127",'
74+ '"deviceId":{"id":127,"prefix":"FST","ubiId":"FST127","name":"M2K-1","externalReference":"FST127","operatorId":0,'
75+ '"displayName":"M2K-1-FST127","displayNameForJsps":"M2K-1-FST127","type":"","hostname":null},"idAsLong":127,'
76+ '"pingStatus":"OK"},{"prefix":"FST","id":125,"name":"M2K-2","sdType":{"id":0,"isObsolete":false,"useWizard":true,'
77+ '"key":"SdType_1_113","manId":1,"manufacturer":"Cisco","model":"IOS","modId":113,"supportedProfiles":"NULL,DES,3DES",'
78+ '"type":0,"familyId":0,"proxy":false,"managed":true,"hasBeenDeleted":false,"utm":false,"reportMail":false,'
79+ '"reportFirewall":false,"stringyfiedIdent":"CiscoIOS","typeHS":"H","name":"CiscoIOS"},"alertMail":false,"silver":false,'
80+ '"gold":false,"report":false,"tamper":false,"ha":false,"dmz":false,"modelFromAsset":"CiscoIOSv","managed":true,'
81+ '"confProfile":false,"planningProfile":false,"externalReference":"FST125","groupId":0,"groupName":"",'
82+ '"maintenanceMode":false,"modId":113,"manId":1,"customerId":6,"monitorPflId":[],"haPeerId":null,'
83+ '"visibleName":"M2K-2-FST125","ubiId":"FST125","deviceId":{"id":125,"prefix":"FST","ubiId":"FST125",'
84+ '"name":"M2K-2","externalReference":"FST125","operatorId":0,"displayName":"M2K-2-FST125",'
85+ '"displayNameForJsps":"M2K-2-FST125","type":"","hostname":null},"idAsLong":125,"pingStatus":"OK"}]' )
8386
8487
8588def customer_info ():
@@ -232,3 +235,15 @@ def conf_profile_fixture():
232235 mock_host_port .return_value = ('api_hostname' , '8080' )
233236 conf_profile = ConfProfile (100 )
234237 return conf_profile
238+
239+
240+ @pytest .fixture
241+ def conf_backup_fixture ():
242+ """Confbackup fixture."""
243+ with patch ('requests.post' ) as mock_post :
244+ mock_post .return_value .json .return_value = {'token' : '12345qwert' }
245+
246+ with patch ('msa_sdk.msa_api.host_port' ) as mock_host_port :
247+ mock_host_port .return_value = ('api_hostname' , '8080' )
248+ conf_backup = ConfBackup ()
249+ return conf_backup
0 commit comments