|
8 | 8 | VALUE_PREFIXES, |
9 | 9 | ) |
10 | 10 |
|
11 | | - |
12 | | -@pytest.fixture |
13 | | -def test_environment(): |
14 | | - with tempfile.TemporaryDirectory() as temp_dir: |
15 | | - temp_path = Path(temp_dir) |
16 | | - ailly_dir = temp_path / "ailly_dir" |
17 | | - ailly_dir.mkdir(exist_ok=True) |
18 | | - |
19 | | - output_path = temp_path / "iam_updates.json" |
20 | | - |
21 | | - create_sample_ailly_files(ailly_dir) |
22 | | - |
23 | | - yield { |
24 | | - "ailly_dir": ailly_dir, |
25 | | - "output_path": output_path, |
26 | | - "temp_dir": temp_path, |
27 | | - } |
28 | | - |
29 | | - |
30 | | -def create_sample_ailly_files(ailly_dir): |
31 | | - # Sample file 1 |
32 | | - file1_path = ailly_dir / "iam-policies.SomeGuide.1.md.ailly.md" |
33 | | - with open(file1_path, "w") as f: |
34 | | - f.write( |
35 | | - """# IAM Policy Example for S3 Bucket Access |
| 11 | +SAMPLE_PROMPT_RESPONSE_1 = """# IAM Policy Example for S3 Bucket Access |
36 | 12 |
|
37 | 13 | This example demonstrates how to create an IAM policy that grants read-only access to an S3 bucket. |
38 | 14 |
|
@@ -75,13 +51,8 @@ def create_sample_ailly_files(ailly_dir): |
75 | 51 |
|
76 | 52 | Remember to replace 'example-bucket' with your actual bucket name when using this policy. |
77 | 53 | """ |
78 | | - ) |
79 | 54 |
|
80 | | - # Sample file 2 |
81 | | - file2_path = ailly_dir / "iam-policies.SomeGuide.2.md.ailly.md" |
82 | | - with open(file2_path, "w") as f: |
83 | | - f.write( |
84 | | - """# IAM Policy Example for EC2 Instance Management |
| 55 | +SAMPLE_PROMPT_RESPONSE_2 = """# IAM Policy Example for EC2 Instance Management |
85 | 56 |
|
86 | 57 | This example demonstrates how to create an IAM policy for EC2 instance management. |
87 | 58 |
|
@@ -128,7 +99,36 @@ def create_sample_ailly_files(ailly_dir): |
128 | 99 |
|
129 | 100 | Modify the region condition to match your specific requirements. |
130 | 101 | """ |
131 | | - ) |
| 102 | + |
| 103 | + |
| 104 | +@pytest.fixture |
| 105 | +def test_environment(): |
| 106 | + with tempfile.TemporaryDirectory() as temp_dir: |
| 107 | + temp_path = Path(temp_dir) |
| 108 | + ailly_dir = temp_path / "ailly_dir" |
| 109 | + ailly_dir.mkdir(exist_ok=True) |
| 110 | + |
| 111 | + output_path = temp_path / "iam_updates.json" |
| 112 | + |
| 113 | + create_sample_ailly_files(ailly_dir) |
| 114 | + |
| 115 | + yield { |
| 116 | + "ailly_dir": ailly_dir, |
| 117 | + "output_path": output_path, |
| 118 | + "temp_dir": temp_path, |
| 119 | + } |
| 120 | + |
| 121 | + |
| 122 | +def create_sample_ailly_files(ailly_dir): |
| 123 | + # Sample file 1 |
| 124 | + file1_path = ailly_dir / "iam-policies.SomeGuide.1.md.ailly.md" |
| 125 | + with open(file1_path, "w") as f: |
| 126 | + f.write(SAMPLE_PROMPT_RESPONSE_1) |
| 127 | + |
| 128 | + # Sample file 2 |
| 129 | + file2_path = ailly_dir / "iam-policies.SomeGuide.2.md.ailly.md" |
| 130 | + with open(file2_path, "w") as f: |
| 131 | + f.write(SAMPLE_PROMPT_RESPONSE_2) |
132 | 132 |
|
133 | 133 |
|
134 | 134 | def test_process_ailly_files(test_environment): |
|
0 commit comments