-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_session_record_analysis.py
48 lines (38 loc) · 1.24 KB
/
test_session_record_analysis.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import os
import logging
import json
from typing import Dict
SDK_REPO = "c:/github/azure-libraries-for-java"
def main():
logging.basicConfig(level=logging.INFO)
process_session_records()
def process_session_records():
for root, dirs, files in os.walk(SDK_REPO):
for name in files:
file_path = os.path.join(root, name)
if (
os.path.splitext(file_path)[1] == ".json"
and "session-records" in file_path
and "target" not in file_path
):
with open(file_path, encoding="utf-8") as f:
try:
record = json.load(f)
found = analysis(record)
if found:
print(file_path)
except Exception as e:
logging.error(f"error {e}")
def analysis(record: Dict) -> bool:
found = False
records = record["networkCallRecords"]
for item in records:
if (
item["Method"] == "PUT"
and item["Response"]["StatusCode"] == "200"
and "azure-asyncoperation" in item["Response"]
):
found = True
break
return found
main()