コード例 #1
0
class UserOwnsAPITest(unittest.TestCase):
    @mock.patch('metadata_service.api.user.get_proxy_client')
    def setUp(self, mock_get_proxy_client: MagicMock) -> None:
        self.mock_client = mock.Mock()
        mock_get_proxy_client.return_value = self.mock_client
        self.api = UserOwnsAPI()

    def test_get(self) -> None:
        self.mock_client.get_table_by_user_relation.return_value = {
            'table': []
        }
        response = self.api.get(user_id='username')
        self.assertEqual(list(response)[1], HTTPStatus.OK)
        self.mock_client.get_table_by_user_relation.assert_called_once()
コード例 #2
0
 def setUp(self, mock_get_proxy_client: MagicMock) -> None:
     self.mock_client = mock.Mock()
     mock_get_proxy_client.return_value = self.mock_client
     self.api = UserOwnsAPI()