mirror of
https://github.com/hacs/integration.git
synced 2025-08-16 17:12:38 +00:00
Add graphql limits to summary (#3831)
This commit is contained in:
@ -364,7 +364,18 @@ class AdjustedHacs(HacsBase):
|
||||
res = await self.async_github_api_method(
|
||||
method=self.githubapi.rate_limit,
|
||||
)
|
||||
return res.data.resources.core.as_dict
|
||||
return {
|
||||
"core": {
|
||||
"used": res.data.resources.core.used,
|
||||
"limit": res.data.resources.core.limit,
|
||||
"reset": res.data.resources.core.reset,
|
||||
},
|
||||
"graphql": {
|
||||
"used": res.data.resources.graphql.used,
|
||||
"limit": res.data.resources.graphql.limit,
|
||||
"reset": res.data.resources.graphql.reset,
|
||||
},
|
||||
}
|
||||
|
||||
summary = {
|
||||
"changed_pct": round((changed / new_count) * 100),
|
||||
|
@ -41,8 +41,10 @@ async def test_generate_category_data_single_repository(
|
||||
|
||||
with open(f"{OUTPUT_DIR}/{category_test_data['category']}/data.json", encoding="utf-8") as file:
|
||||
snapshots.assert_match(
|
||||
safe_json_dumps(recursive_remove_key(json.loads(file.read()), ("last_fetched",))),
|
||||
f"scripts/data/generate_category_data/single/{category_test_data['category']}/{category_test_data['repository']}/data.json",
|
||||
safe_json_dumps(recursive_remove_key(
|
||||
json.loads(file.read()), ("last_fetched",))),
|
||||
f"scripts/data/generate_category_data/single/{category_test_data['category']}/{
|
||||
category_test_data['repository']}/data.json",
|
||||
)
|
||||
|
||||
with open(
|
||||
@ -50,7 +52,17 @@ async def test_generate_category_data_single_repository(
|
||||
) as file:
|
||||
snapshots.assert_match(
|
||||
safe_json_dumps(json.loads(file.read())),
|
||||
f"scripts/data/generate_category_data/single/{category_test_data['category']}/{category_test_data['repository']}/repositories.json",
|
||||
f"scripts/data/generate_category_data/single/{category_test_data['category']}/{
|
||||
category_test_data['repository']}/repositories.json",
|
||||
)
|
||||
|
||||
with open(
|
||||
f"{OUTPUT_DIR}/summary.json", encoding="utf-8"
|
||||
) as file:
|
||||
snapshots.assert_match(
|
||||
safe_json_dumps(json.loads(file.read())),
|
||||
f"scripts/data/generate_category_data/single/{category_test_data['category']}/{
|
||||
category_test_data['repository']}/summary.json",
|
||||
)
|
||||
|
||||
|
||||
@ -70,8 +82,10 @@ async def test_generate_category_data(
|
||||
|
||||
with open(f"{OUTPUT_DIR}/{category_test_data['category']}/data.json", encoding="utf-8") as file:
|
||||
snapshots.assert_match(
|
||||
safe_json_dumps(recursive_remove_key(json.loads(file.read()), ("last_fetched",))),
|
||||
f"scripts/data/generate_category_data/{category_test_data['category']}//data.json",
|
||||
safe_json_dumps(recursive_remove_key(
|
||||
json.loads(file.read()), ("last_fetched",))),
|
||||
f"scripts/data/generate_category_data/{
|
||||
category_test_data['category']}//data.json",
|
||||
)
|
||||
|
||||
with open(
|
||||
@ -79,5 +93,15 @@ async def test_generate_category_data(
|
||||
) as file:
|
||||
snapshots.assert_match(
|
||||
safe_json_dumps(recursive_remove_key(json.loads(file.read()), ())),
|
||||
f"scripts/data/generate_category_data/{category_test_data['category']}/repositories.json",
|
||||
f"scripts/data/generate_category_data/{
|
||||
category_test_data['category']}/repositories.json",
|
||||
)
|
||||
|
||||
with open(
|
||||
f"{OUTPUT_DIR}/summary.json", encoding="utf-8"
|
||||
) as file:
|
||||
snapshots.assert_match(
|
||||
safe_json_dumps(recursive_remove_key(json.loads(file.read()), ())),
|
||||
f"scripts/data/generate_category_data/{
|
||||
category_test_data['category']}/summary.json",
|
||||
)
|
||||
|
@ -0,0 +1,19 @@
|
||||
{
|
||||
"changed": 1,
|
||||
"changed_pct": 100,
|
||||
"current_count": 0,
|
||||
"diff": 1,
|
||||
"new_count": 1,
|
||||
"rate_limit": {
|
||||
"core": {
|
||||
"limit": 5000,
|
||||
"reset": 1691591363,
|
||||
"used": 1
|
||||
},
|
||||
"graphql": {
|
||||
"limit": 5000,
|
||||
"reset": 1691593228,
|
||||
"used": 7
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
{
|
||||
"changed": 2,
|
||||
"changed_pct": 100,
|
||||
"current_count": 0,
|
||||
"diff": 2,
|
||||
"new_count": 2,
|
||||
"rate_limit": {
|
||||
"core": {
|
||||
"limit": 5000,
|
||||
"reset": 1691591363,
|
||||
"used": 1
|
||||
},
|
||||
"graphql": {
|
||||
"limit": 5000,
|
||||
"reset": 1691593228,
|
||||
"used": 7
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
{
|
||||
"changed": 1,
|
||||
"changed_pct": 100,
|
||||
"current_count": 0,
|
||||
"diff": 1,
|
||||
"new_count": 1,
|
||||
"rate_limit": {
|
||||
"core": {
|
||||
"limit": 5000,
|
||||
"reset": 1691591363,
|
||||
"used": 1
|
||||
},
|
||||
"graphql": {
|
||||
"limit": 5000,
|
||||
"reset": 1691593228,
|
||||
"used": 7
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
{
|
||||
"changed": 1,
|
||||
"changed_pct": 100,
|
||||
"current_count": 0,
|
||||
"diff": 1,
|
||||
"new_count": 1,
|
||||
"rate_limit": {
|
||||
"core": {
|
||||
"limit": 5000,
|
||||
"reset": 1691591363,
|
||||
"used": 1
|
||||
},
|
||||
"graphql": {
|
||||
"limit": 5000,
|
||||
"reset": 1691593228,
|
||||
"used": 7
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
{
|
||||
"changed": 1,
|
||||
"changed_pct": 100,
|
||||
"current_count": 0,
|
||||
"diff": 1,
|
||||
"new_count": 1,
|
||||
"rate_limit": {
|
||||
"core": {
|
||||
"limit": 5000,
|
||||
"reset": 1691591363,
|
||||
"used": 1
|
||||
},
|
||||
"graphql": {
|
||||
"limit": 5000,
|
||||
"reset": 1691593228,
|
||||
"used": 7
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
{
|
||||
"changed": 1,
|
||||
"changed_pct": 100,
|
||||
"current_count": 0,
|
||||
"diff": 1,
|
||||
"new_count": 1,
|
||||
"rate_limit": {
|
||||
"core": {
|
||||
"limit": 5000,
|
||||
"reset": 1691591363,
|
||||
"used": 1
|
||||
},
|
||||
"graphql": {
|
||||
"limit": 5000,
|
||||
"reset": 1691593228,
|
||||
"used": 7
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
{
|
||||
"changed": 1,
|
||||
"changed_pct": 100,
|
||||
"current_count": 0,
|
||||
"diff": 1,
|
||||
"new_count": 1,
|
||||
"rate_limit": {
|
||||
"core": {
|
||||
"limit": 5000,
|
||||
"reset": 1691591363,
|
||||
"used": 1
|
||||
},
|
||||
"graphql": {
|
||||
"limit": 5000,
|
||||
"reset": 1691593228,
|
||||
"used": 7
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
{
|
||||
"changed": 1,
|
||||
"changed_pct": 100,
|
||||
"current_count": 0,
|
||||
"diff": 1,
|
||||
"new_count": 1,
|
||||
"rate_limit": {
|
||||
"core": {
|
||||
"limit": 5000,
|
||||
"reset": 1691591363,
|
||||
"used": 1
|
||||
},
|
||||
"graphql": {
|
||||
"limit": 5000,
|
||||
"reset": 1691593228,
|
||||
"used": 7
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
{
|
||||
"changed": 1,
|
||||
"changed_pct": 100,
|
||||
"current_count": 0,
|
||||
"diff": 1,
|
||||
"new_count": 1,
|
||||
"rate_limit": {
|
||||
"core": {
|
||||
"limit": 5000,
|
||||
"reset": 1691591363,
|
||||
"used": 1
|
||||
},
|
||||
"graphql": {
|
||||
"limit": 5000,
|
||||
"reset": 1691593228,
|
||||
"used": 7
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
{
|
||||
"changed": 1,
|
||||
"changed_pct": 100,
|
||||
"current_count": 0,
|
||||
"diff": 1,
|
||||
"new_count": 1,
|
||||
"rate_limit": {
|
||||
"core": {
|
||||
"limit": 5000,
|
||||
"reset": 1691591363,
|
||||
"used": 1
|
||||
},
|
||||
"graphql": {
|
||||
"limit": 5000,
|
||||
"reset": 1691593228,
|
||||
"used": 7
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
{
|
||||
"changed": 1,
|
||||
"changed_pct": 100,
|
||||
"current_count": 0,
|
||||
"diff": 1,
|
||||
"new_count": 1,
|
||||
"rate_limit": {
|
||||
"core": {
|
||||
"limit": 5000,
|
||||
"reset": 1691591363,
|
||||
"used": 1
|
||||
},
|
||||
"graphql": {
|
||||
"limit": 5000,
|
||||
"reset": 1691593228,
|
||||
"used": 7
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
{
|
||||
"changed": 1,
|
||||
"changed_pct": 100,
|
||||
"current_count": 0,
|
||||
"diff": 1,
|
||||
"new_count": 1,
|
||||
"rate_limit": {
|
||||
"core": {
|
||||
"limit": 5000,
|
||||
"reset": 1691591363,
|
||||
"used": 1
|
||||
},
|
||||
"graphql": {
|
||||
"limit": 5000,
|
||||
"reset": 1691593228,
|
||||
"used": 7
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user