Пример #1
0
 def test_unglueit_summary_fetch_error(self, mock_get):
     unglueTest = Unglueit('999999999')
     mock_req = MagicMock()
     mock_get.return_value = mock_req
     mock_req.status_code = 500
     with self.assertRaises(UnglueError):
         unglueTest.getSummary('1')
Пример #2
0
    def test_unglueit_summary_fetch(self, mock_parse, mock_get):
        unglueTest = Unglueit('999999999')
        mock_req = MagicMock()
        mock_get.return_value = mock_req
        mock_req.status_code = 200
        mock_req.text = 'fakeXMLDocument'

        testSummary = unglueTest.getSummary('1')
        mock_parse.assert_called_once_with('fakeXMLDocument')
        self.assertEqual(testSummary, 'fakeXMLDocument')