|
35 | 35 | import re
|
36 | 36 | import os
|
37 | 37 |
|
38 |
| -sys.path.insert(0, "..") |
| 38 | +THIS_TEST_PATH = os.path.dirname(os.path.abspath(__file__)) |
39 | 39 |
|
40 | 40 | from loguru import logger
|
41 | 41 | from passlib.hash import cisco_type7
|
|
52 | 52 |
|
53 | 53 | def testParse_valid_filepath_01():
|
54 | 54 | """Test reading a cisco ios config-file on disk (without the config keyword); ref github issue #262."""
|
55 |
| - parse = CiscoConfParse("../configs/sample_01.ios") |
| 55 | + parse = CiscoConfParse(f"{THIS_TEST_PATH}/fixtures/configs/sample_01.ios") |
56 | 56 | assert len(parse.ioscfg) == 450
|
57 | 57 |
|
58 | 58 |
|
59 | 59 | def testParse_valid_filepath_02():
|
60 | 60 | """Test reading a cisco ios config-file on disk (from filename in the config parameter); ref github issue #262."""
|
61 |
| - parse = CiscoConfParse(config="../configs/sample_01.ios") |
| 61 | + parse = CiscoConfParse(config=f"{THIS_TEST_PATH}/fixtures/configs/sample_01.ios") |
62 | 62 | assert len(parse.ioscfg) == 450
|
63 | 63 |
|
64 | 64 |
|
65 | 65 | def testParse_valid_filepath_03():
|
66 | 66 | """Test reading an f5 config-file on disk (without the config keyword); ref github issue #262."""
|
67 |
| - parse = CiscoConfParse("../configs/sample_01.f5", comment="#", syntax="junos") |
| 67 | + parse = CiscoConfParse(f"{THIS_TEST_PATH}/fixtures/configs/sample_01.f5", comment="#", syntax="junos") |
68 | 68 | assert len(parse.ioscfg) == 16
|
69 | 69 |
|
70 | 70 |
|
71 | 71 | def testParse_valid_filepath_04():
|
72 | 72 | """Test reading an f5 config-file on disk (from filename in the config parameter); ref github issue #262."""
|
73 |
| - parse = CiscoConfParse(config="../configs/sample_01.f5", comment="#", syntax="junos") |
| 73 | + parse = CiscoConfParse(config=f"{THIS_TEST_PATH}/fixtures/configs/sample_01.f5", comment="#", syntax="junos") |
74 | 74 | assert len(parse.ioscfg) == 16
|
75 | 75 |
|
76 | 76 |
|
77 | 77 | def testParse_valid_filepath_05():
|
78 | 78 | """Test reading a junos config-file on disk (without the config keyword); ref github issue #262."""
|
79 |
| - parse = CiscoConfParse("../configs/sample_01.junos", comment="#", syntax="junos") |
| 79 | + parse = CiscoConfParse(f"{THIS_TEST_PATH}/fixtures/configs/sample_01.junos", comment="#", syntax="junos") |
80 | 80 | assert len(parse.ioscfg) == 79
|
81 | 81 |
|
82 | 82 |
|
83 | 83 | def testParse_valid_filepath_06():
|
84 | 84 | """Test reading a junos config-file on disk (from filename in the config parameter); ref github issue #262."""
|
85 |
| - parse = CiscoConfParse(config="../configs/sample_01.junos", comment="#", syntax="junos") |
| 85 | + parse = CiscoConfParse(config=f"{THIS_TEST_PATH}/fixtures/configs/sample_01.junos", comment="#", syntax="junos") |
86 | 86 | assert len(parse.ioscfg) == 79
|
87 | 87 |
|
88 | 88 |
|
@@ -119,11 +119,11 @@ def testParse_f5_as_ios_00(parse_f01_ios):
|
119 | 119 | def testParse_f5_as_ios_02(parse_f02_ios_01):
|
120 | 120 | """
|
121 | 121 | Test parsing a brace-delimited f5 config with ios syntax. Use
|
122 |
| - configs/sample_02.f5 as the test config. That f5 config is pre-parsed in |
| 122 | + fixtures/configs/sample_02.f5 as the test config. That f5 config is pre-parsed in |
123 | 123 | conftest.py as 'parse_f02_ios'.
|
124 | 124 |
|
125 | 125 | This Config Parsing Syntax:
|
126 |
| - parse_f02_ios = CiscoConfParse('configs/sample_02.f5', syntax='ios') |
| 126 | + parse_f02_ios = CiscoConfParse('fixtures/configs/sample_02.f5', syntax='ios') |
127 | 127 |
|
128 | 128 | Ensure that line numbers, parent line numbers, and config text line up
|
129 | 129 | correctly... important note... closing curly-braces should be assigned as
|
@@ -1985,7 +1985,7 @@ def testValues_HDiff_02():
|
1985 | 1985 | )
|
1986 | 1986 | def testValues_HDiff_10():
|
1987 | 1987 | """
|
1988 |
| - Test parsing an f5 config with ios syntax. Use configs/sample_01.f5 as |
| 1988 | + Test parsing an f5 config with ios syntax. Use fixtures/configs/sample_01.f5 as |
1989 | 1989 | the test config. That f5 config is pre-parsed in conftest.py as
|
1990 | 1990 | 'parse_f01_ios'.
|
1991 | 1991 | """
|
|
0 commit comments