Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tests/units/node/stats.py
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@sugarlabs.org>2014-05-13 02:16:35 (GMT)
committer Aleksey Lim <alsroot@sugarlabs.org>2014-05-13 02:18:47 (GMT)
commit92540d7c70b662aaf29fc6cbb93617f72dae9900 (patch)
tree43e49a08be950606586218b3fdf39e1407e0aa58 /tests/units/node/stats.py
parent745194765f8ba4a0ea5fcbda249b64d9743d6697 (diff)
Count rating on demand
Diffstat (limited to 'tests/units/node/stats.py')
-rwxr-xr-xtests/units/node/stats.py68
1 files changed, 0 insertions, 68 deletions
diff --git a/tests/units/node/stats.py b/tests/units/node/stats.py
index 348daec..91b4dee 100755
--- a/tests/units/node/stats.py
+++ b/tests/units/node/stats.py
@@ -371,74 +371,6 @@ class StatsTest(tests.Test):
],
this.call(method='GET', cmd='stats', limit=10))
- def test_StatContextRating(self):
- ts = int(time.time())
- volume = self.start_master(auth=RootAuth())
- self.node_routes.stats_init('.', 1, ['RRA:AVERAGE:0.5:1:10'])
-
- guid = this.call(method='POST', path=['context'], content={'title': '', 'summary': '', 'description': '', 'type': 'activity'})
- self.node_routes.stats_commit()
- self.assertEqual([0, 0], volume['context'][guid]['rating'])
-
- post1 = this.call(method='POST', path=['post'], content={'context': guid, 'type': 'review', 'title': '', 'message': '', 'vote': 0})
- self.node_routes.stats_commit()
- self.assertEqual([1, 0], volume['context'][guid]['rating'])
-
- post2 = this.call(method='POST', path=['post'], content={'context': guid, 'type': 'review', 'title': '', 'message': '', 'vote': 1})
- self.node_routes.stats_commit()
- self.assertEqual([2, 1], volume['context'][guid]['rating'])
-
- post3 = this.call(method='POST', path=['post'], content={'context': guid, 'type': 'review', 'title': '', 'message': '', 'vote': 4})
- self.node_routes.stats_commit()
- self.assertEqual([3, 5], volume['context'][guid]['rating'])
-
- this.call(method='DELETE', path=['post', post2])
- self.node_routes.stats_commit()
- self.assertEqual([2, 4], volume['context'][guid]['rating'])
-
- this.call(method='DELETE', path=['post', post1])
- self.node_routes.stats_commit()
- self.assertEqual([1, 4], volume['context'][guid]['rating'])
-
- this.call(method='DELETE', path=['post', post3])
- self.node_routes.stats_commit()
- self.assertEqual([0, 0], volume['context'][guid]['rating'])
-
- def test_StatTopicRating(self):
- ts = int(time.time())
- volume = self.start_master(auth=RootAuth())
- self.node_routes.stats_init('.', 1, ['RRA:AVERAGE:0.5:1:10'])
-
- guid = this.call(method='POST', path=['post'], content={'context': '', 'type': 'post', 'title': '', 'message': ''})
- self.assertEqual([0, 0], volume['post'][guid]['rating'])
-
- self.node_routes.stats_commit()
- self.assertEqual([0, 0], volume['post'][guid]['rating'])
-
- post1 = this.call(method='POST', path=['post'], content={'context': '', 'topic': guid, 'type': 'post', 'title': '', 'message': '', 'vote': 0})
- self.node_routes.stats_commit()
- self.assertEqual([1, 0], volume['post'][guid]['rating'])
-
- post2 = this.call(method='POST', path=['post'], content={'context': '', 'topic': guid, 'type': 'post', 'title': '', 'message': '', 'vote': 1})
- self.node_routes.stats_commit()
- self.assertEqual([2, 1], volume['post'][guid]['rating'])
-
- post3 = this.call(method='POST', path=['post'], content={'context': '', 'topic': guid, 'type': 'post', 'title': '', 'message': '', 'vote': 4})
- self.node_routes.stats_commit()
- self.assertEqual([3, 5], volume['post'][guid]['rating'])
-
- this.call(method='DELETE', path=['post', post2])
- self.node_routes.stats_commit()
- self.assertEqual([2, 4], volume['post'][guid]['rating'])
-
- this.call(method='DELETE', path=['post', post1])
- self.node_routes.stats_commit()
- self.assertEqual([1, 4], volume['post'][guid]['rating'])
-
- this.call(method='DELETE', path=['post', post3])
- self.node_routes.stats_commit()
- self.assertEqual([0, 0], volume['post'][guid]['rating'])
-
if __name__ == '__main__':
tests.main()