@@ -0,0 +1,1837 @@
+# -*- coding: utf8 -*-%0A# This file is part of PyBossa.%0A#%0A# Copyright (C) 2015 SF Isle of Man Limited%0A#%0A# PyBossa is free software: you can redistribute it and/or modify%0A# it under the terms of the GNU Affero General Public License as published by%0A# the Free Software Foundation, either version 3 of the License, or%0A# (at your option) any later version.%0A#%0A# PyBossa is distributed in the hope that it will be useful,%0A# but WITHOUT ANY WARRANTY; without even the implied warranty of%0A# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A# GNU Affero General Public License for more details.%0A#%0A# You should have received a copy of the GNU Affero General Public License%0A# along with PyBossa.  If not, see %3Chttp://www.gnu.org/licenses/%3E.%0A%0Afrom pybossa.dashboard import dashboard_active_users_week%0Afrom default import Test, with_context%0Afrom mock import patch, MagicMock%0A%0A%0Aclass TestDashBoardActiveUsers(Test):%0A%0A    @with_context%0A    @patch('pybossa.dashboard.db')%0A    def test_materialized_view_refreshed(self, db_mock):%0A        %22%22%22Test JOB dashboard materialized view is refreshed.%22%22%22%0A        result = MagicMock()%0A        result.exists = True%0A        results = %5Bresult%5D%0A        db_mock.slave_session.execute.return_value = results%0A        res = dashboard_active_users_week()%0A        assert db_mock.session.execute.called%0A        assert res == 'Materialized view refreshed'%0A%0A    @with_context%0A    @patch('pybossa.dashboard.db')%0A    def test_materialized_view_created(self, db_mock):%0A        %22%22%22Test JOB dashboard materialized view is created.%22%22%22%0A        result = MagicMock()%0A        result.exists = False%0A        results = %5Bresult%5D%0A        db_mock.slave_session.execute.return_value = results%0A        res = dashboard_active_users_week()%0A        assert db_mock.session.commit.called%0A        assert res == 'Materialized view created'%0A

Test Dashboard Active Users.