def test(self, time): inst = PathSegmentDB() inst._db = create_mock(['delete']) recs = [] for i in range(5): rec = create_mock(['exp_time', 'pcb']) rec.exp_time = i rec.pcb = create_mock(["short_desc"]) recs.append({'record': rec}) time.return_value = 2 # Call ntools.eq_(inst._exp_call_records(recs), recs[2:]) # Tests inst._db.delete.assert_called_once_with(recs[:2])
def test(self): inst = PathSegmentDB() inst._parse_call_kwargs = create_mock() inst._parse_call_kwargs.return_value = {"arg1": "val1"} inst._exp_call_records = create_mock() inst._sort_call_pcbs = create_mock() inst._db = create_mock() # Call ntools.eq_(inst("data", a="b"), inst._sort_call_pcbs.return_value) # Tests inst._parse_call_kwargs.assert_called_once_with({"a": "b"}) inst._db.assert_called_once_with("data", arg1="val1") inst._exp_call_records.assert_called_once_with(inst._db.return_value) inst._sort_call_pcbs.assert_called_once_with( False, inst._exp_call_records.return_value)