Ejemplo n.º 1
0
    def test_fetch_all_bad_response(self):
        client = Client(self.api_url)
        pattern_manager = PatternManager(client)

        with patch.object(client, 'get', return_value={}) as get_mock:
            with self.assertRaises(ResponseStructureError):
                pattern_manager.fetch_all()

        self.assertTrue(get_mock.called)
        get_mock.assert_called_with('pattern')
Ejemplo n.º 2
0
    def test_fetch_all(self):
        client = Client(self.api_url)
        pattern_manager = PatternManager(client)

        with patch.object(client, 'get', return_value={'list':
                                                       []}) as get_mock:
            pattern_manager.fetch_all()

        self.assertTrue(get_mock.called)
        get_mock.assert_called_with('pattern')