Esempio n. 1
0
    def test_get_monthly_site_metrics(self):
        '''
        Since we are testing results for individual getters in other test
        methods in this class, our prime goal is to ensure proper structure
        '''
        expected_top_lvl_keys = [
            'total_site_users', 'total_course_completions',
            'total_course_enrollments', 'total_site_courses',
            'monthly_active_users'
        ]
        expected_2nd_lvl_keys = ['current_month', 'history']
        expected_history_elem_keys = ['period', 'value']
        actual = get_monthly_site_metrics(site=self.alpha_site)

        assert set(actual.keys()) == set(expected_top_lvl_keys)
        for key, val in six.iteritems(actual):
            assert set(val.keys()) == set(expected_2nd_lvl_keys)
            assert len(val['history']) > 0
            assert set(
                val['history'][0].keys()) == set(expected_history_elem_keys)
Esempio n. 2
0
 def test_get_today(self):
     date_for = self.today
     data = get_monthly_site_metrics(date_for=date_for)
     assert set(data.keys()) == self.expected_keys