import unittest import datetime import rhsm_display rhsm_display.set_display() from subscription_manager.gui import contract_selection from subscription_manager import managerlib def stubSelectedCallback(self, pool): pass def stubCancelCallback(self): pass class ContractSelection(unittest.TestCase): pool = {'productName': 'SomeProduct', 'consumed': '3', 'quantity': '10', 'startDate': datetime.datetime.now(tz=managerlib.ServerTz(0)).isoformat(), 'endDate': datetime.datetime.now(tz=managerlib.ServerTz(0)).isoformat(), 'contractNumber': 'contractNumber', 'attributes': [], 'productAttributes': []} def test_contract_selection_show(self): cs = contract_selection.ContractSelectionWindow(selected_callback=stubSelectedCallback, cancel_callback=stubCancelCallback)
import unittest import rhsm_display rhsm_display.set_display() from subscription_manager.gui import progress class TestProgress(unittest.TestCase): def setUp(self): self.pw = progress.Progress("test title", "this is a test label") def test_set_progress_0(self): self.pw.set_progress(0, 100) def test_set_progress_0_0(self): self.pw.set_progress(0, 0) def test_set_progress_100(self): self.pw.set_progress(100, 100) def test_set_progress_100_0(self): self.pw.set_progress(100, 0) def test_set_progress_100_50(self): self.pw.set_progress(100, 50) def test_pulse(self): self.pw.pulse() def test_hide(self):