From af43aeae916097698412d2e603afd2b0ccb8bd4e Mon Sep 17 00:00:00 2001 From: sadnub Date: Fri, 2 Oct 2020 09:44:21 -0400 Subject: [PATCH] fixing tests --- api/tacticalrmm/agents/tests.py | 1 + api/tacticalrmm/logs/tests.py | 1 - api/tacticalrmm/tacticalrmm/test.py | 53 +++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 1 deletion(-) diff --git a/api/tacticalrmm/agents/tests.py b/api/tacticalrmm/agents/tests.py index f0c8bab5..f47580e4 100644 --- a/api/tacticalrmm/agents/tests.py +++ b/api/tacticalrmm/agents/tests.py @@ -356,6 +356,7 @@ class TestAgentViews(BaseTestCase): url = f"/agents/{self.agent.pk}/meshcentral/" r = self.client.get(url) + self.assertEqual(r.status_code, 200) # TODO # decode the cookie diff --git a/api/tacticalrmm/logs/tests.py b/api/tacticalrmm/logs/tests.py index 11027254..43ef00ac 100644 --- a/api/tacticalrmm/logs/tests.py +++ b/api/tacticalrmm/logs/tests.py @@ -9,7 +9,6 @@ class TestAuditViews(TacticalTestCase): def setUp(self): self.authenticate() self.setup_coresettings() - self.agent_setup() def create_audit_records(self): # user jim agent logs diff --git a/api/tacticalrmm/tacticalrmm/test.py b/api/tacticalrmm/tacticalrmm/test.py index 9896e1ae..9cd45207 100644 --- a/api/tacticalrmm/tacticalrmm/test.py +++ b/api/tacticalrmm/tacticalrmm/test.py @@ -46,6 +46,59 @@ class TacticalTestCase(TestCase): r = switch.get(method) self.assertEqual(r.status_code, 401) + def agent_setup(self): + self.agent = Agent.objects.create( + operating_system="Windows 10", + plat="windows", + plat_release="windows-Server2019", + hostname="DESKTOP-TEST123", + salt_id="aksdjaskdjs", + local_ip="10.0.25.188", + agent_id="71AHC-AA813-HH1BC-AAHH5-00013|DESKTOP-TEST123", + services=[ + { + "pid": 880, + "name": "AeLookupSvc", + "status": "stopped", + "binpath": "C:\\Windows\\system32\\svchost.exe -k netsvcs", + "username": "localSystem", + "start_type": "manual", + "description": "Processes application compatibility cache requests for applications as they are launched", + "display_name": "Application Experience", + }, + { + "pid": 812, + "name": "ALG", + "status": "stopped", + "binpath": "C:\\Windows\\System32\\alg.exe", + "username": "NT AUTHORITY\\LocalService", + "start_type": "manual", + "description": "Provides support for 3rd party protocol plug-ins for Internet Connection Sharing", + "display_name": "Application Layer Gateway Service", + }, + ], + public_ip="74.13.24.14", + total_ram=16, + used_ram=33, + disks={ + "C:": { + "free": "42.3G", + "used": "17.1G", + "total": "59.5G", + "device": "C:", + "fstype": "NTFS", + "percent": 28, + } + }, + boot_time=8173231.4, + logged_in_username="John", + client="Google", + site="Main Office", + monitoring_type="server", + description="Test PC", + mesh_node_id="abcdefghijklmnopAABBCCDD77443355##!!AI%@#$%#*", + last_seen=djangotime.now(), + ) class BaseTestCase(TestCase): def setUp(self):