Ejemplo n.º 1
0
    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())
Ejemplo n.º 2
0
    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())
Ejemplo n.º 3
0
    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)
Ejemplo n.º 4
0
 def test_evaluate_different_action(self):
     mock = self.MockLazyResult('hello world')
     response = Response('mock', mock)
     self.assertEqual('hello world', response.evaluate())
Ejemplo n.º 5
0
 def test_evaluate(self):
     mock = self.MockLazyResult('hello')
     response = Response('mock', mock)
     self.assertEqual('hello', response.evaluate())