1
1
# Copyright 2017 Internap.
2
2
#
3
- # Licensed under the Apache License, Version 2.0 (the " License" );
3
+ # Licensed under the Apache License, Version 2.0 (the ' License' );
4
4
# you may not use this file except in compliance with the License.
5
5
# You may obtain a copy of the License at
6
6
#
7
7
# http://www.apache.org/licenses/LICENSE-2.0
8
8
#
9
9
# Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an " AS IS" BASIS,
10
+ # distributed under the License is distributed on an ' AS IS' BASIS,
11
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
# See the License for the specific language governing permissions and
13
13
# limitations under the License.
@@ -25,27 +25,26 @@ def test_client_creation_works(self):
25
25
26
26
result = self .ub_client .client .contact_list (client_id = client_id )
27
27
28
- self .assertEqual (result .get ('1' ).get ("client_id" ), client_id )
29
- self .assertEqual (result .get ('1' ).get ("description" ), 'Primary Contact' )
28
+ contacts = list (result .values ())
29
+
30
+ self .assertEqual (contacts [0 ].get ('client_id' ), client_id )
31
+ self .assertEqual (contacts [0 ].get ('description' ), 'Primary Contact' )
30
32
31
33
def test_list_all_contacts_works (self ):
32
34
self .ub_client .client .contact_add (client_id = '1234' )
33
35
self .ub_client .client .contact_add (client_id = '1234' )
34
36
self .ub_client .client .contact_add (client_id = '1235' )
35
37
36
38
result = self .ub_client .client .contact_list (client_id = '1234' )
39
+ contacts = list (result .values ())
37
40
38
- self .assertDictEqual (
39
- result ,
40
- {
41
- '2' : {'client_id' : '1234' , 'contact_id' : '2' },
42
- '3' : {'client_id' : '1234' , 'contact_id' : '3' }
43
- }
44
- )
41
+ self .assertEqual (len (contacts ), 2 )
42
+ self .assertEqual (contacts [0 ].get ('client_id' ), '1234' )
43
+ self .assertEqual (contacts [1 ].get ('client_id' ), '1234' )
45
44
46
45
def test_list_all_contacts_raises_if_client_id_not_found (self ):
47
46
with self .assertRaises (UbersmithException ) as exc :
48
47
self .ub_client .client .contact_list (client_id = '1234' )
49
48
50
49
self .assertEqual (exc .exception .code , 1 )
51
- self .assertEqual (exc .exception .message , " Invalid client_id specified." )
50
+ self .assertEqual (exc .exception .message , ' Invalid client_id specified.' )
0 commit comments