);
insert or ignore into flavors values
+("tea", 7),
("espresso", 2),
("espresso lungo", 3),
("cappuccino", 1),
('1111', 'espresso lungo', datetime('now', 'localtime', '-95 second')),
('1111', 'Club-Mate 0,5 l', datetime('now', 'localtime', '-95 second')),
('1111', 'Club-Mate 0,33 l', datetime('now', 'localtime', '-95 second')),
+('1111', 'tea', datetime('now', 'localtime', '-95 second')),
('1111', 'espresso lungo', datetime('now', 'localtime', '-90 second')),
('1111', 'Club-Mate 0,5 l', datetime('now', 'localtime', '-90 second')),
('1111', 'Club-Mate 0,33 l', datetime('now', 'localtime', '-90 second')),
('2222', 'Club-Mate 0,33 l', datetime('now', 'localtime', '-95 second')),
('3333', 'espresso lungo', datetime('now', 'localtime', '-99 seconds')),
('3333', 'Club-Mate 0,33 l', datetime('now', 'localtime', '-99 seconds')),
+('3333', 'tea', datetime('now', 'localtime', '-99 second')),
+('3333', 'tea', datetime('now', 'localtime', '-95 second')),
('3333', 'espresso lungo', datetime('now', 'localtime', '-95 second')),
('3333', 'Club-Mate 0,5 l', datetime('now', 'localtime', '-95 second')),
('3333', 'Club-Mate 0,33 l', datetime('now', 'localtime', '-95 second'));
topsorted
)
+class TopTeaDrinkers(TestCase):
+ def setUp(self):
+ create_test_db(TESTDB_FILENAME)
+ self.db = Db(TESTDB_FILENAME)
+
+ def tearDown(self):
+ delete_test_db(TESTDB_FILENAME)
+
+ def test_top_tea_drinkers(self):
+ top = self.db.get_top_tea_drinkers()
+ assert top == [
+ ("clone", 2),
+ ("tester", 1),
+ ]
+
class DrunkSum(TestCase):
tdy = datetime.now()
tdy += timedelta(days=1)