def test_listOfListsWithChangeInRank(self): lastweek = self.now - datetime.timedelta(days=7) lastweek_str = datetimeutil.date_to_string(lastweek.date()) params = self.params params.startDate = self.now.date() - datetime.timedelta(days=14) query_list = tcbs.getListOfTopCrashersBySignature query_range = tcbs.rangeOfQueriesGenerator( self.connection, self.params, query_list ) res = tcbs.listOfListsWithChangeInRank(query_range) res_expected = [[{ 'count': 5L, 'mac_count': 0L, 'content_count': 0, 'first_report': lastweek_str, 'previousRank': 0, 'currentRank': 0, 'startup_percent': None, 'versions': 'plugin1, plugin2', 'first_report_exact': lastweek_str + ' 00:00:00', 'percentOfTotal': 0.625, 'changeInRank': 0, 'is_gc_count': 10L, 'win_count': 0L, 'changeInPercentOfTotal': 0.041666666666666963, 'linux_count': 5L, 'hang_count': 5L, 'signature': 'Fake Signature #1', 'versions_count': 2, 'previousPercentOfTotal': 0.58333333333333304, 'plugin_count': 0 }, { 'count': 3L, 'mac_count': 1L, 'content_count': 0, 'first_report': lastweek_str, 'previousRank': 1, 'currentRank': 1, 'startup_percent': None, 'versions': 'plugin1, plugin2, plugin3, plugin4, plugin5, plugin6', 'first_report_exact': lastweek_str + ' 00:00:00', 'percentOfTotal': 0.375, 'changeInRank': 0, 'is_gc_count': 1L, 'win_count': 1L, 'changeInPercentOfTotal': -0.041666666666667018, 'linux_count': 1L, 'hang_count': 0L, 'signature': 'Fake Signature #2', 'versions_count': 6, 'previousPercentOfTotal': 0.41666666666666702, 'plugin_count': 0 }]]
def test_listOfListsWithChangeInRank(self): lastweek = self.now - datetime.timedelta(days=7) lastweek_str = datetimeutil.date_to_string(lastweek.date()) params = self.params params.startDate = self.now.date() - datetime.timedelta(days=14) query_list = tcbs.getListOfTopCrashersBySignature query_range = tcbs.rangeOfQueriesGenerator(self.connection, self.params, query_list) res = tcbs.listOfListsWithChangeInRank(query_range) res_expected = [[{ 'count': 5L, 'mac_count': 0L, 'content_count': 0, 'first_report': lastweek_str, 'previousRank': 0, 'currentRank': 0, 'startup_percent': None, 'versions': 'plugin1, plugin2', 'first_report_exact': lastweek_str + ' 00:00:00', 'percentOfTotal': 0.625, 'changeInRank': 0, 'is_gc_count': 10L, 'win_count': 0L, 'changeInPercentOfTotal': 0.041666666666666963, 'linux_count': 5L, 'hang_count': 5L, 'signature': 'Fake Signature #1', 'versions_count': 2, 'previousPercentOfTotal': 0.58333333333333304, 'plugin_count': 0, 'total_crashes': 8 }, { 'count': 3L, 'mac_count': 1L, 'content_count': 0, 'first_report': lastweek_str, 'previousRank': 1, 'currentRank': 1, 'startup_percent': None, 'versions': 'plugin1, plugin2, plugin3, plugin4, plugin5, plugin6', 'first_report_exact': lastweek_str + ' 00:00:00', 'percentOfTotal': 0.375, 'changeInRank': 0, 'is_gc_count': 1L, 'win_count': 1L, 'changeInPercentOfTotal': -0.041666666666667018, 'linux_count': 1L, 'hang_count': 0L, 'signature': 'Fake Signature #2', 'versions_count': 6, 'previousPercentOfTotal': 0.41666666666666702, 'plugin_count': 0, 'total_crashes': 8 }]]
def test_rangeOfQueriesGenerator(self): lastweek = self.now.date() - datetime.timedelta(days=7) query_list = tcbs.getListOfTopCrashersBySignature res = tcbs.rangeOfQueriesGenerator(self.connection, self.params, query_list) generate = res.next() sig_1 = generate.next() sig_2 = generate.next() eq_(sig_1[0], "Fake Signature #1") eq_(sig_2[0], "Fake Signature #2") eq_(sig_1[8].date(), lastweek) eq_(sig_2[8].date(), lastweek) eq_(sig_1[10], 0.625) eq_(sig_2[10], 0.375) assert_raises(StopIteration, generate.next)
def test_listOfListsWithChangeInRank(self): lastweek = self.now - datetime.timedelta(days=7) lastweek_str = datetimeutil.date_to_string(lastweek.date()) params = self.params params.startDate = self.now.date() - datetime.timedelta(days=14) query_list = tcbs.getListOfTopCrashersBySignature query_range = tcbs.rangeOfQueriesGenerator(self.connection, self.params, query_list) res = tcbs.listOfListsWithChangeInRank(query_range) res_expected = [ [ { "count": 5L, "mac_count": 0L, "content_count": 0, "first_report": lastweek_str, "previousRank": 0, "currentRank": 0, "startup_percent": None, "versions": "plugin1, plugin2", "first_report_exact": lastweek_str + " 00:00:00", "percentOfTotal": 0.625, "changeInRank": 0, "is_gc_count": 10L, "win_count": 0L, "changeInPercentOfTotal": 0.041666666666666963, "linux_count": 5L, "hang_count": 5L, "signature": "Fake Signature #1", "versions_count": 2, "previousPercentOfTotal": 0.58333333333333304, "plugin_count": 0, "total_crashes": 8, }, { "count": 3L, "mac_count": 1L, "content_count": 0, "first_report": lastweek_str, "previousRank": 1, "currentRank": 1, "startup_percent": None, "versions": "plugin1, plugin2, plugin3, plugin4, plugin5, plugin6", "first_report_exact": lastweek_str + " 00:00:00", "percentOfTotal": 0.375, "changeInRank": 0, "is_gc_count": 1L, "win_count": 1L, "changeInPercentOfTotal": -0.041666666666667018, "linux_count": 1L, "hang_count": 0L, "signature": "Fake Signature #2", "versions_count": 6, "previousPercentOfTotal": 0.41666666666666702, "plugin_count": 0, "total_crashes": 8, }, ] ]