forked from softlayer/softlayer-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrwhois_tests.py
More file actions
81 lines (66 loc) · 3.18 KB
/
rwhois_tests.py
File metadata and controls
81 lines (66 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
"""
SoftLayer.tests.CLI.modules.rwhois_tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:license: MIT, see LICENSE for more details.
"""
from SoftLayer.CLI import exceptions
from SoftLayer import testing
import json
class RWhoisTests(testing.TestCase):
def test_edit_nothing(self):
result = self.run_command(['rwhois', 'edit'])
self.assertEqual(result.exit_code, 2)
self.assertIsInstance(result.exception, exceptions.CLIAbort)
def test_edit(self):
result = self.run_command(['rwhois', 'edit',
'--address1=address line 1',
'--address2=address line 2',
'--company=Company, Inc',
'--city=Dallas',
'--country=United States',
'--firstname=John',
'--lastname=Smith',
'--postal=12345',
'--state=TX',
'--state=TX',
'--private'])
self.assert_no_fail(result)
self.assertEqual(result.output, "")
self.assert_called_with('SoftLayer_Network_Subnet_Rwhois_Data',
'editObject',
args=({'city': 'Dallas',
'firstName': 'John',
'companyName': 'Company, Inc',
'address1': 'address line 1',
'address2': 'address line 2',
'lastName': 'Smith',
'abuseEmail': '[email protected]',
'state': 'TX',
'country': 'United States',
'postalCode': '12345',
'privateResidenceFlag': True},),
identifier='id')
def test_edit_public(self):
result = self.run_command(['rwhois', 'edit', '--public'])
self.assert_no_fail(result)
self.assertEqual(result.output, "")
self.assert_called_with('SoftLayer_Network_Subnet_Rwhois_Data',
'editObject',
args=({'privateResidenceFlag': False},),
identifier='id')
def test_show(self):
self.maxDiff = 100000
result = self.run_command(['rwhois', 'show'])
expected = {'Abuse Email': 'abuseEmail',
'Address 1': 'address1',
'Address 2': 'address2',
'City': 'city',
'Company': 'companyName',
'Country': 'country',
'Name': 'firstName lastName',
'Postal Code': 'postalCode',
'State': '-',
'Private Residence': True}
self.assert_no_fail(result)
self.assertEqual(json.loads(result.output), expected)