8
8
from phpypam .core .exceptions import PHPyPAMException , PHPyPAMEntityNotFoundException
9
9
10
10
11
- with open ('tests/vars/server.yml' ) as c :
12
- server = yaml .safe_load (c )
13
-
14
- connection_params = dict (
15
- url = server ['url' ],
16
- app_id = server ['app_id' ],
17
- username = server ['username' ],
18
- password = server ['password' ],
19
- ssl_verify = True
20
- )
21
-
22
- not_found_cases = [
23
- dict (controller = 'subnets' , path = 'cidr/1.2.3.4' , params = None ),
24
- dict (controller = 'addresses' , path = 'search/1.2.3.4' ),
25
- dict (controller = 'vlans' , path = '/1337' ),
26
- dict (controller = 'vrf' ),
27
- dict (controller = 'devices' , path = '/1337' ),
28
- dict (controller = 'sections' , params = {'filter_by' : 'name' , 'filter_value' : 'not_existing_section' , 'filter_match' : 'full' }),
29
- dict (controller = 'tools/device_types' , path = '/1337' ),
30
- dict (controller = 'addresses' , path = 'search_hostname/not_existing_hostname' )
31
- ]
11
+ with open ('tests/vars/server.yml' ) as conn :
12
+ connection_params = yaml .safe_load (conn )
13
+
14
+ with open ('tests/vars/search_exceptions.yml' ) as config :
15
+ not_found_cases = yaml .safe_load (config )['not_found_cases' ]
32
16
33
17
34
18
@vcr .use_cassette (cassette_name ('test_entity_not_found_exception' ),
@@ -51,4 +35,4 @@ def test_entity_not_found_exception(case):
51
35
pi .get_entity (case ['controller' ], controller_path = case .pop ('path' , None ), params = case .pop ('params' , None ))
52
36
53
37
# assert exception message is in all not found outputs
54
- assert e .value . args [ 0 ] in PHPyPAMException ._NOT_FOUND_MESSAGES
38
+ assert str ( e .value ) in PHPyPAMException ._NOT_FOUND_MESSAGES
0 commit comments