def get_last_tid(self):
        try:
            spec = {'tid': {'$gt': 0}}
            sort = [('tid', -1)]
            row = self.db.docs.find_one(spec, sort=sort)
        except Exception as e:
            raise DatabaseException(e)
        if row:
            return row['tid']
        return 0
def test_cnli_caps_on(fake_qtile, patched_cnli, fake_window):
    widget = patched_cnli.CapsNumLockIndicator()

    # Simulate Caps on
    MockCapsNumLockIndicator.index = 1

    fakebar = FakeBar([widget], window=fake_window)
    widget._configure(fake_qtile, fakebar)
    text = widget.poll()

    assert text == "Caps on Num on"