From 3b8b7ca71261025282cacf29d0bc594675858d90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Alm=C3=A9n?= <78877636+almenscorner@users.noreply.github.com> Date: Tue, 13 Feb 2024 08:27:34 +0100 Subject: [PATCH] add test for vpp used license count exclusion --- .../Backup/Intune/test_backup_applications.py | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/Backup/Intune/test_backup_applications.py b/tests/Backup/Intune/test_backup_applications.py index 1938e724..b50fc649 100644 --- a/tests/Backup/Intune/test_backup_applications.py +++ b/tests/Backup/Intune/test_backup_applications.py @@ -5,6 +5,8 @@ import unittest +import json + from pathlib import Path from unittest.mock import patch @@ -105,6 +107,26 @@ def test_backup_macOS_vpp_app(self): ) self.assertEqual(1, self.count["config_count"]) + def test_backup_vpp_app_exclude_licensecout(self): + """The folder should be created, the file should be created, and the count should be 1.""" + + self.app_base_data["value"][0]["@odata.type"] = "#microsoft.graph.iosVppApp" + self.app_base_data["value"][0]["usedLicenseCount"] = "1" + + self.makeapirequest.return_value = self.app_base_data + + self.exclude = ["VPPusedlicenseCount"] + + self.count = savebackup( + self.directory.path, "json", self.exclude, self.token, self.append_id + ) + + app_data = json.load( + open(self.directory.path + "/Applications/iOS/test_iOSVppApp_test.json") + ) + + self.assertTrue(app_data.get("VPPusedlicenseCount") is None) + def test_backup_win32_lob_app_and_displayVersion(self): """The folder should be created, the file should be created, and the count should be 1."""