Skip to content

Commit

Permalink
[RFR] Automate_TC MTA-3756 (#1228)
Browse files Browse the repository at this point in the history
* added TC for python custom rule analysis

Signed-off-by: midays <[email protected]>

* PR requested changes

Signed-off-by: midays <[email protected]>

---------

Signed-off-by: midays <[email protected]>
  • Loading branch information
midays authored Sep 25, 2024
1 parent 4f73965 commit 73482c3
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,21 @@ describe(["@tier2"], "Bug MTA-2015: Custom Rules in analyses", function () {
app.verifyFileNotValidXML();
});

it("Python custom rules file analysis", function () {
const app = new Analysis(
getRandomApplicationData("python-app-custom-rules", {
sourceData: this.appData["python-demo-app"],
}),
getRandomAnalysisData(this.analysisData["python_demo_application"])
);
tackleTestappName = app.name;
applications.push(app);
app.create();
app.analyze();
app.verifyAnalysisStatus(AnalysisStatuses.completed);
// TODO: add assertion to check if rules fired once obtained a rules file
});

after("Clear test data", function () {
deleteByList(applications);
mavenCredential.delete();
Expand Down
6 changes: 6 additions & 0 deletions cypress/fixtures/analysis.json
Original file line number Diff line number Diff line change
Expand Up @@ -1225,5 +1225,11 @@
"appName": "bookserver-app",
"source": "Source code",
"target": ["Application server migration to"]
},
"python_demo_application": {
"source": "Source code",
"target": [],
"appName": "python-app-custom-rules",
"customRule": ["python-rules.yaml"]
}
}
4 changes: 4 additions & 0 deletions cypress/fixtures/application.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,9 @@
"jmh-gradle-example": {
"repoType": "Git",
"sourceRepo": "https://github.com/melix/jmh-gradle-example"
},
"python-demo-app": {
"repoType": "Git",
"sourceRepo": "https://github.com/Shopify/sample-django-app"
}
}
17 changes: 17 additions & 0 deletions cypress/fixtures/yaml/python-rules.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
- message: python sample rule 001
ruleID: python-sample-rule-001
description: CUSTOM RULE FOR PYTHON
when:
python.referenced:
pattern: "hello_world"
- message: python sample rule 002
ruleID: python-sample-rule-002
when:
python.referenced:
pattern: "speak"
- message: python sample rule 003
ruleID: python-sample-rule-003
when:
python.referenced:
pattern: "create_custom_resource_definition"

0 comments on commit 73482c3

Please sign in to comment.