def test_as_json_with_fallback_different_fallback(self): mock_fallback = self.MockLazyResult('hello and goodbye to the world') response_fallback = Response('mock', mock_fallback) mock = self.MockLazyResult(None) response = Response('mock', mock, fallback=response_fallback) response.evaluate() self.assertEqual('hello and goodbye to the world', response.as_json())
def test_status_with_fallback_different_fallback(self): mock_fallback = self.MockLazyResult('') response_fallback = Response('mock', mock_fallback, status=404) mock = self.MockLazyResult(None) response = Response('mock', mock, fallback=response_fallback) response.evaluate() self.assertEqual(404, response.status())
def test_as_json_with_parent(self): mock_parent = self.MockLazyResult('hello world') response_parent = Response('mock', mock_parent) mock = self.MockLazyResult('hello world') response = Response('mock', mock, parent=response_parent) response.evaluate() self.assertTrue(mock_parent.called)
def test_evaluate_different_action(self): mock = self.MockLazyResult('hello world') response = Response('mock', mock) self.assertEqual('hello world', response.evaluate())
def test_evaluate(self): mock = self.MockLazyResult('hello') response = Response('mock', mock) self.assertEqual('hello', response.evaluate())