88
99import json
1010
11- from pprint import pprint as pp
11+ from pprint import pprint as pp
12+
1213
1314class ReportTests (testing .TestCase ):
1415
@@ -93,14 +94,14 @@ def test_bandwidth_report(self):
9394 ])
9495
9596 self .assert_no_fail (result )
96-
97+
9798 stripped_output = '[' + result .output .split ('[' , 1 )[1 ]
9899 json_output = json .loads (stripped_output )
99100 pp (json .loads (stripped_output ))
100101 print ("======= ^^^^^^^^^ ==============" )
101102 self .assertEqual (json_output [0 ]['hostname' ], 'pool1' )
102103 self .assertEqual (json_output [0 ]['private_in' ], 30 )
103-
104+
104105 self .assertEqual (6 , len (self .calls ('SoftLayer_Metric_Tracking_Object' , 'getSummaryData' )))
105106 self .assert_called_with ('SoftLayer_Metric_Tracking_Object' , 'getSummaryData' , identifier = 1 )
106107 self .assert_called_with ('SoftLayer_Metric_Tracking_Object' , 'getSummaryData' , identifier = 3 )
@@ -110,25 +111,25 @@ def test_bandwidth_report(self):
110111 self .assert_called_with ('SoftLayer_Metric_Tracking_Object' , 'getSummaryData' , identifier = 203 )
111112 call = self .calls ('SoftLayer_Metric_Tracking_Object' , 'getSummaryData' , identifier = 1 )[0 ]
112113 expected_args = ('2016-02-04 00:00:00 ' , '2016-03-04 12:34:56 ' ,
113- [{
114- 'keyName' : 'PUBLICIN' ,
115- 'name' : 'publicIn' ,
116- 'summaryType' : 'sum' ,
117- }, {
118- 'keyName' : 'PUBLICOUT' ,
119- 'name' : 'publicOut' ,
120- 'summaryType' : 'sum' ,
121- }, {
122- 'keyName' : 'PRIVATEIN' ,
123- 'name' : 'privateIn' ,
124- 'summaryType' : 'sum' ,
125- }, {
126- 'keyName' : 'PRIVATEOUT' ,
127- 'name' : 'privateOut' ,
128- 'summaryType' : 'sum' ,
129- }],
130- 300 ,
131- )
114+ [{
115+ 'keyName' : 'PUBLICIN' ,
116+ 'name' : 'publicIn' ,
117+ 'summaryType' : 'sum' ,
118+ }, {
119+ 'keyName' : 'PUBLICOUT' ,
120+ 'name' : 'publicOut' ,
121+ 'summaryType' : 'sum' ,
122+ }, {
123+ 'keyName' : 'PRIVATEIN' ,
124+ 'name' : 'privateIn' ,
125+ 'summaryType' : 'sum' ,
126+ }, {
127+ 'keyName' : 'PRIVATEOUT' ,
128+ 'name' : 'privateOut' ,
129+ 'summaryType' : 'sum' ,
130+ }],
131+ 300 ,
132+ )
132133 self .assertEqual (expected_args , call .args )
133134
134135 def test_virtual_bandwidth_report (self ):
@@ -192,25 +193,25 @@ def test_virtual_bandwidth_report(self):
192193 self .assert_called_with ('SoftLayer_Metric_Tracking_Object' , 'getSummaryData' , identifier = 203 )
193194 call = self .calls ('SoftLayer_Metric_Tracking_Object' , 'getSummaryData' , identifier = 1 )[0 ]
194195 expected_args = ('2016-02-04 00:00:00 ' , '2016-03-04 12:34:56 ' ,
195- [{
196- 'keyName' : 'PUBLICIN' ,
197- 'name' : 'publicIn' ,
198- 'summaryType' : 'sum' ,
199- }, {
200- 'keyName' : 'PUBLICOUT' ,
201- 'name' : 'publicOut' ,
202- 'summaryType' : 'sum' ,
203- }, {
204- 'keyName' : 'PRIVATEIN' ,
205- 'name' : 'privateIn' ,
206- 'summaryType' : 'sum' ,
207- }, {
208- 'keyName' : 'PRIVATEOUT' ,
209- 'name' : 'privateOut' ,
210- 'summaryType' : 'sum' ,
211- }],
212- 300 ,
213- )
196+ [{
197+ 'keyName' : 'PUBLICIN' ,
198+ 'name' : 'publicIn' ,
199+ 'summaryType' : 'sum' ,
200+ }, {
201+ 'keyName' : 'PUBLICOUT' ,
202+ 'name' : 'publicOut' ,
203+ 'summaryType' : 'sum' ,
204+ }, {
205+ 'keyName' : 'PRIVATEIN' ,
206+ 'name' : 'privateIn' ,
207+ 'summaryType' : 'sum' ,
208+ }, {
209+ 'keyName' : 'PRIVATEOUT' ,
210+ 'name' : 'privateOut' ,
211+ 'summaryType' : 'sum' ,
212+ }],
213+ 300 ,
214+ )
214215 self .assertEqual (expected_args , call .args )
215216
216217 def test_server_bandwidth_report (self ):
@@ -267,30 +268,30 @@ def test_server_bandwidth_report(self):
267268 self .assertEqual (json_output [1 ]['private_in' ], 0 )
268269 self .assertEqual (json_output [2 ]['private_in' ], 30 )
269270 self .assertEqual (json_output [3 ]['type' ], 'hardware' )
270-
271+
271272 self .assertEqual (4 , len (self .calls ('SoftLayer_Metric_Tracking_Object' , 'getSummaryData' )))
272273 self .assert_called_with ('SoftLayer_Metric_Tracking_Object' , 'getSummaryData' , identifier = 101 )
273274 self .assert_called_with ('SoftLayer_Metric_Tracking_Object' , 'getSummaryData' , identifier = 103 )
274275
275276 call = self .calls ('SoftLayer_Metric_Tracking_Object' , 'getSummaryData' , identifier = 1 )[0 ]
276277 expected_args = ('2016-02-04 00:00:00 ' , '2016-03-04 12:34:56 ' ,
277- [{
278- 'keyName' : 'PUBLICIN' ,
279- 'name' : 'publicIn' ,
280- 'summaryType' : 'sum' ,
281- }, {
282- 'keyName' : 'PUBLICOUT' ,
283- 'name' : 'publicOut' ,
284- 'summaryType' : 'sum' ,
285- }, {
286- 'keyName' : 'PRIVATEIN' ,
287- 'name' : 'privateIn' ,
288- 'summaryType' : 'sum' ,
289- }, {
290- 'keyName' : 'PRIVATEOUT' ,
291- 'name' : 'privateOut' ,
292- 'summaryType' : 'sum' ,
293- }],
294- 300 ,
295- )
278+ [{
279+ 'keyName' : 'PUBLICIN' ,
280+ 'name' : 'publicIn' ,
281+ 'summaryType' : 'sum' ,
282+ }, {
283+ 'keyName' : 'PUBLICOUT' ,
284+ 'name' : 'publicOut' ,
285+ 'summaryType' : 'sum' ,
286+ }, {
287+ 'keyName' : 'PRIVATEIN' ,
288+ 'name' : 'privateIn' ,
289+ 'summaryType' : 'sum' ,
290+ }, {
291+ 'keyName' : 'PRIVATEOUT' ,
292+ 'name' : 'privateOut' ,
293+ 'summaryType' : 'sum' ,
294+ }],
295+ 300 ,
296+ )
296297 self .assertEqual (expected_args , call .args )
0 commit comments