def test_case_no_namespace_includes_all(self):
     metric = PagesCreated(namespaces=[],
                           start_date='2013-06-19 00:00:00',
                           end_date='2013-08-21 00:00:00')
     results = metric(self.editor_ids, self.mwSession)
     assert_equal(results[self.editors[0].user_id]["pages_created"], 3)
     assert_equal(results[self.editors[1].user_id]["pages_created"], 1)
Beispiel #2
0
 def test_case_uses_date_range(self):
     metric = PagesCreated(
         namespaces=[301, 302, 303],
         start_date='2013-06-20',
         end_date='2013-07-21'
     )
     results = metric(list(self.cohort), self.mwSession)
     assert_equal(results[self.evan_id]["pages_created"], 2)
    def test_filters_out_other_editors(self):
        self.common_cohort_4(cohort=False)
        metric = PagesCreated(namespaces=[301, 302, 303],
                              start_date='2013-06-19 00:00:00',
                              end_date='2013-08-21 00:00:00')
        results = metric(self.editor_ids, self.mwSession)

        assert_equal(len(results), 2)
 def test_case_uses_date_range(self):
     metric = PagesCreated(namespaces=[301, 302, 303],
                           start_date='2013-06-19 00:00:00',
                           end_date='2013-07-21 00:00:00')
     # TODO these tests need to go through cohort service,
     # cannot be using a storage object
     results = metric(self.editor_ids, self.mwSession)
     assert_equal(results[self.editors[0].user_id]["pages_created"], 2)
    def test_runs_for_an_entire_wiki(self):
        self.common_cohort_4(cohort=False)
        metric = PagesCreated(namespaces=[301, 302, 303],
                              start_date='2013-06-19 00:00:00',
                              end_date='2013-08-21 00:00:00')
        results = metric(None, self.mwSession)

        assert_equal(len(results), 4)
        assert_equal(results[self.editors[0].user_id]["pages_created"], 3)
        assert_equal(results[self.editors[1].user_id]["pages_created"], 1)
        # NOTE: this is a bit precarious as it assumes the order of test data inserts
        assert_equal(results[self.editors[0].user_id + 2]["pages_created"], 3)