Skip to content

Commit

Permalink
feature: 提供 Agent 包管理后台接口 (closed TencentBlueKing#1683)
Browse files Browse the repository at this point in the history
  • Loading branch information
ping15 committed Nov 20, 2023
1 parent 46f9a87 commit 8994249
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions apps/node_man/tests/test_views/test_package_manage_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def clear_agent_data(cls):
Tag.objects.all().delete()

@patch("apps.node_man.handlers.cmdb.get_request_username", return_value="admin")
def test_list(self):
def test_list(self, *args, **kwargs):
# 和之前的builder.make加起来100
create_gse_package(99, start_id=1000)

Expand All @@ -47,7 +47,7 @@ def test_list(self):
self.assertEqual(len(result["data"]["list"]), 2)

@patch("apps.node_man.handlers.cmdb.get_request_username", return_value="admin")
def test_list_with_filter_condition(self):
def test_list_with_filter_condition(self, *args, **kwargs):
# 不筛选
result = self.client.get(path="/api/agent/package/")
print(f"result1={result}")
Expand Down Expand Up @@ -123,21 +123,21 @@ def collect_all_tag_names(cls, tags):
return tag_name_set

@patch("apps.node_man.handlers.cmdb.get_request_username", return_value="admin")
def test_update(self):
def test_update(self, *args, **kwargs):
first_gse_package = GsePackages.objects.first()
self.assertEqual(first_gse_package.is_ready, True)
self.client.put(path=f"/api/agent/package/{first_gse_package.id}/", data={"is_ready": False})
self.assertEqual(GsePackages.objects.first().is_ready, False)

@patch("apps.node_man.handlers.cmdb.get_request_username", return_value="admin")
def test_destroy(self):
def test_destroy(self, *args, **kwargs):
gse_packages = GsePackages.objects.all()
self.assertEqual(len(gse_packages), 1)
self.client.delete(path=f"/api/agent/package/{gse_packages.first().id}/")
self.assertEqual(len(GsePackages.objects.all()), 0)

@patch("apps.node_man.handlers.cmdb.get_request_username", return_value="admin")
def test_quick_search_condition(self):
def test_quick_search_condition(self, *args, **kwargs):
result = self.client.get(path="/api/agent/package/quick_search_condition/")
print(f"result2={result}")
for condition in result["data"]:
Expand All @@ -159,7 +159,7 @@ def test_quick_search_condition(self):
)

@patch("apps.node_man.handlers.cmdb.get_request_username", return_value="admin")
def test_filter_condition_with_agent_pkg_manage(self):
def test_filter_condition_with_agent_pkg_manage(self, *args, **kwargs):
result = MetaHandler().filter_condition("agent_pkg_manage")
print(f"result3={result}")
for condition in result:
Expand Down

0 comments on commit 8994249

Please sign in to comment.