1515
1616class AccountCLITests (testing .TestCase ):
1717
18+ def set_up (self ):
19+ self .SLNOE = 'SoftLayer_Notification_Occurrence_Event'
20+
21+ #### slcli account event-detail ####
1822 def test_event_detail (self ):
1923 result = self .run_command (['account' , 'event-detail' , '1234' ])
2024 self .assert_no_fail (result )
21- self .assert_called_with ('SoftLayer_Notification_Occurrence_Event' , 'getObject' , identifier = '1234' )
25+ self .assert_called_with (self .SLNOE , 'getObject' , identifier = '1234' )
26+
27+ def test_event_details_ack (self ):
28+ result = self .run_command (['account' , 'event-detail' , '1234' , '--ack' ])
29+ self .assert_no_fail (result )
30+ self .assert_called_with (self .SLNOE , 'getObject' , identifier = '1234' )
31+ self .assert_called_with (self .SLNOE , 'acknowledgeNotification' , identifier = '1234' )
32+
33+ #### slcli account events ####
34+ def test_events (self ):
35+ result = self .run_command (['account' , 'events' ])
36+ self .assert_no_fail (result )
37+ self .assert_called_with (self .SLNOE , 'getAllObjects' )
38+
39+ def test_event_ack_all (self ):
40+ result = self .run_command (['account' , 'events' , '--ack-all' ])
41+ self .assert_called_with (self .SLNOE , 'getAllObjects' )
42+ self .assert_called_with (self .SLNOE , 'acknowledgeNotification' , identifier = 1234 )
43+
44+
45+ #### slcli account invoice-detail ####
46+ def test_invoice_detail (self ):
47+ result = self .run_command (['account' , 'invoice-detail' , '1234' ])
48+ self .assert_no_fail (result )
49+ self .assert_called_with ('SoftLayer_Billing_Invoice' , 'getInvoiceTopLevelItems' , identifier = '1234' )
50+
51+ def test_invoice_detail (self ):
52+ result = self .run_command (['account' , 'invoice-detail' , '1234' , '--details' ])
53+ self .assert_no_fail (result )
54+ self .assert_called_with ('SoftLayer_Billing_Invoice' , 'getInvoiceTopLevelItems' , identifier = '1234' )
55+
56+ #### slcli account invoices ####
57+ def test_invoices (self ):
58+ result = self .run_command (['account' , 'invoices' ])
59+ self .assert_no_fail (result )
60+ self .assert_called_with ('SoftLayer_Account' , 'getInvoices' , limit = 50 )
61+
62+ def test_invoices_limited (self ):
63+ result = self .run_command (['account' , 'invoices' , '--limit=10' ])
64+ self .assert_no_fail (result )
65+ self .assert_called_with ('SoftLayer_Account' , 'getInvoices' , limit = 10 )
66+
67+ def test_invoices_closed (self ):
68+ _filter = {
69+ 'invoices' : {
70+ 'createDate' : {
71+ 'operation' : 'orderBy' ,
72+ 'options' : [{
73+ 'name' : 'sort' ,
74+ 'value' : ['DESC' ]
75+ }]
76+ }
77+ }
78+ }
79+ result = self .run_command (['account' , 'invoices' , '--closed' ])
80+ self .assert_no_fail (result )
81+ self .assert_called_with ('SoftLayer_Account' , 'getInvoices' , limit = 50 , filter = _filter )
82+
83+ def test_invoices_all (self ):
84+ result = self .run_command (['account' , 'invoices' , '--all' ])
85+ self .assert_no_fail (result )
86+ self .assert_called_with ('SoftLayer_Account' , 'getInvoices' , limit = 50 )
87+
88+ #### slcli account summary ####
89+ result = self .run_command (['account' , 'summary' ])
90+ self .assert_no_fail (result )
91+ self .assert_called_with ('SoftLayer_Account' , 'getObject' )
92+
93+
0 commit comments