Commit cb5c1e73 authored by Julien Cristau's avatar Julien Cristau
Browse files

[test] port to cubicweb 3.19

parent 65a4bd1c8161
......@@ -13,7 +13,7 @@ author_email = 'contact@logilab.fr'
description = 'cubicweb integrated awstats frontend'
web = 'http://www.cubicweb.org/project/%s' % distname
__depends__ = {'cubicweb': '>= 3.15.0',}
__depends__ = {'cubicweb': '>= 3.19.0',}
__recommends__ = {'cubicweb-raphael': None,}
classifiers = [
......
......@@ -20,7 +20,7 @@ BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
BuildRequires: %{python} %{python}-setuptools
Requires: cubicweb >= 3.15.0
Requires: cubicweb >= 3.19.0
%description
awstats component for the CubicWeb framework
......
......@@ -10,7 +10,7 @@ Homepage: http://www.cubicweb.org/project/awstats
Package: cubicweb-awstats
Architecture: all
Depends: cubicweb-common (>= 3.15.0)
Depends: cubicweb-common (>= 3.19.0)
Recommends: cubicweb-raphael
Description: cubicweb integrated awstats frontend
CubicWeb is a semantic web application framework.
......
......@@ -11,20 +11,20 @@ from cubes.awstats.utils import compress_old_hits
class CompressTest(CubicWebTC):
def test_compress(self):
req = self.request()
with self.admin_access.client_cnx() as cnx:
update_stats=defaultdict(int)
content = req.create_entity('Content', title=u'test')
content = cnx.create_entity('Content', title=u'test')
for day in date.date_range(datetime.now()-timedelta(200), datetime.now()):
stp = req.create_entity('StatPeriod', start=day, stop=day+timedelta(1))
hit = req.create_entity('Hits', hit_type=u'normal',
stp = cnx.create_entity('StatPeriod', start=day, stop=day+timedelta(1))
hit = cnx.create_entity('Hits', hit_type=u'normal',
count=random.choice(range(2000)),
period=stp, stats_about=content)
self.assertEqual(len(req.execute('Any X WHERE X is Hits')), 200)
self.assertEqual(len(req.execute('Any P WHERE P is StatPeriod, P start S, P stop E HAVING E-S >= 27')), 0)
compress_old_hits(req, update_stats)
self.assertEqual(len(cnx.execute('Any X WHERE X is Hits')), 200)
self.assertEqual(len(cnx.execute('Any P WHERE P is StatPeriod, P start S, P stop E HAVING E-S >= 27')), 0)
compress_old_hits(cnx, update_stats)
# XXX SQLite bug ?
# self.assertEqual(len(req.execute('Any P WHERE P is StatPeriod, P start S, P stop E HAVING E-S >= 27')), 9)
self.assertNotEqual(len(req.execute('Any X WHERE X is Hits')), 200)
self.assertNotEqual(len(cnx.execute('Any X WHERE X is Hits')), 200)
if __name__ == '__main__':
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment