Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 32 additions & 32 deletions aws_doc_sdk_examples_tools/lliam/test/run_ailly_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,7 @@
VALUE_PREFIXES,
)


@pytest.fixture
def test_environment():
with tempfile.TemporaryDirectory() as temp_dir:
temp_path = Path(temp_dir)
ailly_dir = temp_path / "ailly_dir"
ailly_dir.mkdir(exist_ok=True)

output_path = temp_path / "iam_updates.json"

create_sample_ailly_files(ailly_dir)

yield {
"ailly_dir": ailly_dir,
"output_path": output_path,
"temp_dir": temp_path,
}


def create_sample_ailly_files(ailly_dir):
# Sample file 1
file1_path = ailly_dir / "iam-policies.SomeGuide.1.md.ailly.md"
with open(file1_path, "w") as f:
f.write(
"""# IAM Policy Example for S3 Bucket Access
SAMPLE_PROMPT_RESPONSE_1 = """# IAM Policy Example for S3 Bucket Access

This example demonstrates how to create an IAM policy that grants read-only access to an S3 bucket.

Expand Down Expand Up @@ -75,13 +51,8 @@ def create_sample_ailly_files(ailly_dir):

Remember to replace 'example-bucket' with your actual bucket name when using this policy.
"""
)

# Sample file 2
file2_path = ailly_dir / "iam-policies.SomeGuide.2.md.ailly.md"
with open(file2_path, "w") as f:
f.write(
"""# IAM Policy Example for EC2 Instance Management
SAMPLE_PROMPT_RESPONSE_2 = """# IAM Policy Example for EC2 Instance Management

This example demonstrates how to create an IAM policy for EC2 instance management.

Expand Down Expand Up @@ -128,7 +99,36 @@ def create_sample_ailly_files(ailly_dir):

Modify the region condition to match your specific requirements.
"""
)


@pytest.fixture
def test_environment():
with tempfile.TemporaryDirectory() as temp_dir:
temp_path = Path(temp_dir)
ailly_dir = temp_path / "ailly_dir"
ailly_dir.mkdir(exist_ok=True)

output_path = temp_path / "iam_updates.json"

create_sample_ailly_files(ailly_dir)

yield {
"ailly_dir": ailly_dir,
"output_path": output_path,
"temp_dir": temp_path,
}


def create_sample_ailly_files(ailly_dir):
# Sample file 1
file1_path = ailly_dir / "iam-policies.SomeGuide.1.md.ailly.md"
with open(file1_path, "w") as f:
f.write(SAMPLE_PROMPT_RESPONSE_1)

# Sample file 2
file2_path = ailly_dir / "iam-policies.SomeGuide.2.md.ailly.md"
with open(file2_path, "w") as f:
f.write(SAMPLE_PROMPT_RESPONSE_2)


def test_process_ailly_files(test_environment):
Expand Down