def test_popup(monkeypatch):
    class FakeCalendar():
        def store(self, *args, **kwargs):
            self.args = args
            self.kwargs = kwargs

    fake = FakeCalendar()
    monkeypatch.setattr(
        'khal.ui.calendarwidget.CalendarWidget.__init__', fake.store)
    see = StartEndEditor(START, END, CONF)
    see.widgets.startdate.keypress((22, ), 'enter')
    assert fake.kwargs['initial'] == date(2015, 4, 26)
    see.widgets.enddate.keypress((22, ), 'enter')
    assert fake.kwargs['initial'] == date(2015, 4, 27)
making sure the popup calendar gets callend with the right inital value
dataset/ETHPy150Open pimutils/khal/tests/ui/test_startendeditor.py/test_popup