Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions tests/integration/exchange_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Live integration test for the Exchange Online planner.

Run with:
python3 -m unittest tests.integration.exchange_test -v
"""

import unittest

from tests.integration import harness

_EMAIL_COLUMN = "Email Id"
_BATCH_FOLDER = "suggested batches"
_BATCH_HEADER = ["Source Exchange Email"]


class ExchangeScanTest(unittest.TestCase):
"""Scans the mailbox in the scan inputs file and checks the scan ran end to end."""

@classmethod
def setUpClass(cls):
cls.case = harness.case_or_skip("exchange")
cls.run_ = harness.run_planner("exchange", cls.case)
cls.inputs = [row[0] for row in cls.case["input"]["rows"]]

def setUp(self):
self.assertEqual(self.run_.errors, [], "The scan reported errors.")
self.assertIsNotNone(self.run_.result, "The scan did not report completion.")

def test_run_log_has_no_errors_or_warnings(self):
self.assertEqual(harness.log_problems(self.run_), [])

def test_report_lists_every_input_mailbox_once(self):
rows = harness.read_csv(self.run_.find_file("user_report_"))
self.assertEqual(harness.entry_problems(self.run_, [row[_EMAIL_COLUMN] for row in rows], self.inputs), [])

def test_batch_files_have_the_right_header(self):
self.assertEqual(harness.batch_file_problems(self.run_, _BATCH_FOLDER, _BATCH_HEADER), [])


if __name__ == "__main__":
unittest.main()
Loading
Loading