Example #1
0
    def test_is_not_running(self, monkeypatch):
        def errors(x):
            raise OperationalError(None, None, None, None)

        monkeypatch.setattr(hooks.models, "Task", FakeState(get=errors))
        with pytest.raises(hooks.SystemCheckError):
            hooks.database_connection() is None
Example #2
0
    def test_is_not_running(self, monkeypatch):
        def errors(x):
            raise OperationalError(None, None, None, None)

        monkeypatch.setattr(hooks.models, 'Task', FakeState(get=errors))
        with pytest.raises(hooks.SystemCheckError):
            hooks.database_connection() is None
Example #3
0
 def test_is_connected(self, monkeypatch):
     monkeypatch.setattr(hooks.models, "Task", FakeState(get=lambda x: None))
     assert hooks.database_connection() is None
Example #4
0
 def test_is_connected(self, monkeypatch):
     monkeypatch.setattr(hooks.models, 'Task',
                         FakeState(get=lambda x: None))
     assert hooks.database_connection() is None