Ejemplo n.º 1
0
 def test_uglueit_work_search_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.getWork()
Ejemplo n.º 2
0
 def test_uglueit_work_id_error(self, mock_get):
     unglueTest = Unglueit('999999999')
     mock_req = MagicMock()
     mock_get.return_value = mock_req
     mock_req.status_code = 200
     mock_req.json.return_value = {
         'objects': [
             {
                 'work': '/api/test/something/'
             }
         ]
     }
     with self.assertRaises(UnglueError):
         unglueTest.getWork()
Ejemplo n.º 3
0
    def test_uglueit_work_search(self, mock_get):
        unglueTest = Unglueit('999999999')
        mock_req = MagicMock()
        mock_get.return_value = mock_req
        mock_req.status_code = 200
        mock_req.json.return_value = {
            'objects': [
                {
                    'work': '/api/test/1/'
                }
            ]
        }

        testWorkID = unglueTest.getWork()
        self.assertEqual(testWorkID, '1')