@@ 67-101 (lines=35) @@ | ||
64 | os.chdir(old_cwd) |
|
65 | ||
66 | ||
67 | def test_cmd_validator_regex(tmpdir): |
|
68 | """ |
|
69 | .. test:: GwCmdValidators search regex test |
|
70 | :tags: gwcmdvalidators |
|
71 | """ |
|
72 | ||
73 | # Creating temporay folder with sub_folders |
|
74 | tmpdir.mkdir("sub_a") |
|
75 | tmpdir.mkdir("sub_b") |
|
76 | tmpdir.mkdir("sub_c") |
|
77 | ||
78 | # Change working directory to temporary folder |
|
79 | old_cwd = os.getcwd() |
|
80 | os.chdir(str(tmpdir)) |
|
81 | ||
82 | class My_Plugin(GwCmdValidatorsPattern): |
|
83 | def __init__(self, app, **kwargs): |
|
84 | self.name = "My_Plugin" |
|
85 | super(My_Plugin, self).__init__(app, **kwargs) |
|
86 | ||
87 | def activate(self): |
|
88 | pass |
|
89 | ||
90 | def deactivate(self): |
|
91 | pass |
|
92 | ||
93 | app = groundwork.App() |
|
94 | plugin = My_Plugin(app) |
|
95 | plugin.activate() |
|
96 | ||
97 | assert plugin.validators.cmd.validate("dir", regex="sub*") is True |
|
98 | assert plugin.validators.cmd.validate("dir", regex="sub_NO*") is False |
|
99 | ||
100 | # Let's change back the working dir, maybe this isn't done pytest itself after each test |
|
101 | os.chdir(old_cwd) |
|
102 | ||
103 | ||
104 | def test_cmd_validator_return_codes(): |
|
@@ 30-64 (lines=35) @@ | ||
27 | plugin.activate() |
|
28 | ||
29 | ||
30 | def test_cmd_validator_search(tmpdir): |
|
31 | """ |
|
32 | .. test:: GwCmdValidators search test |
|
33 | :tags: gwcmdvalidators |
|
34 | :links: S_102F8 |
|
35 | """ |
|
36 | # Creating temporay folder with sub_folders |
|
37 | tmpdir.mkdir("sub_a") |
|
38 | tmpdir.mkdir("sub_b") |
|
39 | tmpdir.mkdir("sub_c") |
|
40 | ||
41 | # Change working directory to temporary folder |
|
42 | old_cwd = os.getcwd() |
|
43 | os.chdir(str(tmpdir)) |
|
44 | ||
45 | class My_Plugin(GwCmdValidatorsPattern): |
|
46 | def __init__(self, app, **kwargs): |
|
47 | self.name = "My_Plugin" |
|
48 | super(My_Plugin, self).__init__(app, **kwargs) |
|
49 | ||
50 | def activate(self): |
|
51 | pass |
|
52 | ||
53 | def deactivate(self): |
|
54 | pass |
|
55 | ||
56 | app = groundwork.App() |
|
57 | plugin = My_Plugin(app) |
|
58 | plugin.activate() |
|
59 | ||
60 | assert plugin.validators.cmd.validate("dir", search="sub_a") is True |
|
61 | assert plugin.validators.cmd.validate("dir", search="NO_KNOWN_FOLDER") is False |
|
62 | ||
63 | # Let's change back the working dir, maybe this isn't done pytest itself after each test |
|
64 | os.chdir(old_cwd) |
|
65 | ||
66 | ||
67 | def test_cmd_validator_regex(tmpdir): |