Skip to content

Commit 5a38b29

Browse files
authored
Merge pull request #62 from abolfazl8131/master
feat(response mock): added mock data as a response
2 parents 95b68ef + b117600 commit 5a38b29

File tree

6 files changed

+19
-10
lines changed

6 files changed

+19
-10
lines changed
0 Bytes
Binary file not shown.
177 Bytes
Binary file not shown.
1.14 KB
Binary file not shown.

app/routes/helm.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
from app.services import (write_installation,edit_directory_generator,execute_pythonfile)
44
from app.models import (HelmTemplateGeneration,Output)
55
from app.prompt_generators import (helm_template_generator)
6-
6+
import os
77
@app.post("/Helm-template/")
88
async def Helm_template_generation(request:HelmTemplateGeneration) -> Output:
9-
9+
if os.environ.get("TEST"):
10+
return Output(output='output')
1011
generated_prompt = helm_template_generator(request)
1112
output = gpt_service(generated_prompt)
1213
edit_directory_generator("helm_generator",output)

app/routes/terraform.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,37 @@
2020
IaC_installation_generator,
2121
)
2222
from app.template_generators.terraform.docker import (IaC_template_generator_docker)
23-
23+
import os
2424

2525
@app.post("/IaC-basic/")
2626
async def IaC_basic_generation(request:IaCBasicInput) -> Output:
27-
27+
if os.environ.get("TEST"):
28+
return Output(output='Terraform developed by hashicorp and it is very usefull')
2829
generated_prompt = IaC_basics_generator(request)
2930
output = gpt_service(generated_prompt)
3031
return Output(output=output)
3132

3233
@app.post("/IaC-bugfix/")
3334
async def IaC_bugfix_generation(request:IaCBugfixInput) -> Output:
34-
35+
if os.environ.get("TEST"):
36+
return Output(output='fix this bug by adding x to the y')
3537
generated_prompt = IaC_bugfix_generator(request)
3638
output = gpt_service(generated_prompt)
3739
return Output(output=output)
3840

3941

4042
@app.post("/IaC-install/")
4143
async def IaC_install_generation(request:IaCInstallationInput) -> Output:
42-
44+
if os.environ.get("TEST"):
45+
return Output(output='apt-get install xyz \n apt-get update (covert them to shell file output)')
4346
generated_prompt = IaC_installation_generator(request)
4447
output = gpt_service(generated_prompt)
4548
return Output(output=output)
4649

4750
@app.post("/IaC-template/docker")
4851
async def IaC_template_generation_docker(request:IaCTemplateGenerationDocker) -> Output:
49-
52+
if os.environ.get("TEST"):
53+
return Output(output='output (nothing special)')
5054
generated_prompt = IaC_template_generator_docker(request)
5155
output = gpt_service(generated_prompt)
5256
edit_directory_generator("terraform_generator",output)
@@ -55,7 +59,8 @@ async def IaC_template_generation_docker(request:IaCTemplateGenerationDocker) ->
5559

5660
@app.post("/IaC-template/aws/ec2")
5761
async def IaC_template_generation_aws_ec2(request:IaCTemplateGenerationEC2) -> Output:
58-
62+
if os.environ.get("TEST"):
63+
return Output(output='output (nothing special)')
5964
generated_prompt = IaC_template_generator_docker(request)
6065
output = gpt_service(generated_prompt)
6166
edit_directory_generator("terraform_generator",output)
@@ -64,7 +69,8 @@ async def IaC_template_generation_aws_ec2(request:IaCTemplateGenerationEC2) -> O
6469

6570
@app.post("/IaC-template/aws/s3")
6671
async def IaC_template_generation_aws_s3(request:IaCTemplateGenerationS3) -> Output:
67-
72+
if os.environ.get("TEST"):
73+
return Output(output='output (nothing special)')
6874
generated_prompt = IaC_template_generator_docker(request)
6975
output = gpt_service(generated_prompt)
7076
edit_directory_generator("terraform_generator",output)
@@ -73,7 +79,8 @@ async def IaC_template_generation_aws_s3(request:IaCTemplateGenerationS3) -> Out
7379

7480
@app.post("/IaC-template/aws/iam")
7581
async def IaC_template_generation_aws_iam(request:IaCTemplateGenerationIAM) -> Output:
76-
82+
if os.environ.get("TEST"):
83+
return Output(output='output (nothing special)')
7784
generated_prompt = IaC_template_generator_docker(request)
7885
output = gpt_service(generated_prompt)
7986
edit_directory_generator("terraform_generator",output)

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ services:
1717
environment:
1818
<<: *common-variables
1919
OPENAI_API_KEY: ${KEY:-}
20+
TEST: ${TEST:-}
2021
MONGO_HOST: mongo_gpt
2122
MONGO_PORT: 27017
2223

0 commit comments

Comments
 (0)