Skip to content

Conversation

@josemacassan
Copy link
Contributor

Add test for approve and change Service Subscription.

@josemacassan josemacassan requested a review from mkudlej February 17, 2025 08:49
Copy link
Collaborator

@mkudlej mkudlej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pytlint output:
tests/integration/test_integration_service_subscriptions.py:35:0: C0304: Final newline missing (missing-final-newline)
threescale_api/resources.py:294:0: W0613: Unused argument 'kwargs' (unused-argument)

@mkudlej
Copy link
Collaborator

mkudlej commented Feb 18, 2025

`pipenv run python -m pytest tests/integration/test_integration_service_subscriptions.py |& tee x
============================= test session starts ==============================
platform linux -- Python 3.12.9, pytest-8.3.4, pluggy-1.5.0
rootdir: /home/mkudlej/work/3scale/mkudlej-3scale-api-python
configfile: pytest.ini
plugins: xdist-3.6.1
collected 5 items

tests/integration/test_integration_service_subscriptions.py EEEEE [100%]

==================================== ERRORS ====================================
______________ ERROR at setup of test_list_service_subscriptions _______________

account_params = {'org_name': 'test-LkYi_Vj3i50', 'username': 'test-LkYi_Vj3i50'}
api = <threescale_api.client.ThreeScaleClient object at 0x7f2f9b9a0aa0>

@pytest.fixture(scope='module')
def account(account_params, api):
  entity = api.accounts.create(params=account_params)

tests/integration/conftest.py:127:


threescale_api/resources.py:189: in create
return self.signup(params=params, **kwargs)
threescale_api/resources.py:212: in signup
url = self.threescale_client.admin_api_url + '/signup'


self = <threescale_api.client.ThreeScaleClient object at 0x7f2f9b9a0aa0>

@property
def admin_api_url(self) -> str:
    """Get admin API url
    Returns(str): URL of the 3scale admin api
    """
  return self.url + "/admin/api"

E TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

threescale_api/client.py:138: TypeError
---------------------------- Captured stderr setup -----------------------------
2025-02-18 09:53:17,840 threescale_api.resources INFO [SIGNUP] Create new Signup: params={'username': 'test-LkYi_Vj3i50', 'org_name': 'test-LkYi_Vj3i50'}, kwargs={}
------------------------------ Captured log setup ------------------------------
INFO threescale_api.resources:resources.py:211 [SIGNUP] Create new Signup: params={'username': 'test-LkYi_Vj3i50', 'org_name': 'test-LkYi_Vj3i50'}, kwargs={}
______________ ERROR at setup of test_create_service_subscription ______________

account_params = {'org_name': 'test-LkYi_Vj3i50', 'username': 'test-LkYi_Vj3i50'}
api = <threescale_api.client.ThreeScaleClient object at 0x7f2f9b9a0aa0>

@pytest.fixture(scope='module')
def account(account_params, api):
  entity = api.accounts.create(params=account_params)

tests/integration/conftest.py:127:


threescale_api/resources.py:189: in create
return self.signup(params=params, **kwargs)
threescale_api/resources.py:212: in signup
url = self.threescale_client.admin_api_url + '/signup'


self = <threescale_api.client.ThreeScaleClient object at 0x7f2f9b9a0aa0>

@property
def admin_api_url(self) -> str:
    """Get admin API url
    Returns(str): URL of the 3scale admin api
    """
  return self.url + "/admin/api"

E TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

threescale_api/client.py:138: TypeError
_______________ ERROR at setup of test_read_service_subscription _______________

account_params = {'org_name': 'test-LkYi_Vj3i50', 'username': 'test-LkYi_Vj3i50'}
api = <threescale_api.client.ThreeScaleClient object at 0x7f2f9b9a0aa0>

@pytest.fixture(scope='module')
def account(account_params, api):
  entity = api.accounts.create(params=account_params)

tests/integration/conftest.py:127:


threescale_api/resources.py:189: in create
return self.signup(params=params, **kwargs)
threescale_api/resources.py:212: in signup
url = self.threescale_client.admin_api_url + '/signup'


self = <threescale_api.client.ThreeScaleClient object at 0x7f2f9b9a0aa0>

@property
def admin_api_url(self) -> str:
    """Get admin API url
    Returns(str): URL of the 3scale admin api
    """
  return self.url + "/admin/api"

E TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

threescale_api/client.py:138: TypeError
___________ ERROR at setup of test_change_plan_service_subscription ____________

account_params = {'org_name': 'test-LkYi_Vj3i50', 'username': 'test-LkYi_Vj3i50'}
api = <threescale_api.client.ThreeScaleClient object at 0x7f2f9b9a0aa0>

@pytest.fixture(scope='module')
def account(account_params, api):
  entity = api.accounts.create(params=account_params)

tests/integration/conftest.py:127:


threescale_api/resources.py:189: in create
return self.signup(params=params, **kwargs)
threescale_api/resources.py:212: in signup
url = self.threescale_client.admin_api_url + '/signup'


self = <threescale_api.client.ThreeScaleClient object at 0x7f2f9b9a0aa0>

@property
def admin_api_url(self) -> str:
    """Get admin API url
    Returns(str): URL of the 3scale admin api
    """
  return self.url + "/admin/api"

E TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

threescale_api/client.py:138: TypeError
_____________ ERROR at setup of test_approve_service_subscription ______________

account_params = {'org_name': 'test-LkYi_Vj3i50', 'username': 'test-LkYi_Vj3i50'}
api = <threescale_api.client.ThreeScaleClient object at 0x7f2f9b9a0aa0>

@pytest.fixture(scope='module')
def account(account_params, api):
  entity = api.accounts.create(params=account_params)

tests/integration/conftest.py:127:


threescale_api/resources.py:189: in create
return self.signup(params=params, **kwargs)
threescale_api/resources.py:212: in signup
url = self.threescale_client.admin_api_url + '/signup'


self = <threescale_api.client.ThreeScaleClient object at 0x7f2f9b9a0aa0>

@property
def admin_api_url(self) -> str:
    """Get admin API url
    Returns(str): URL of the 3scale admin api
    """
  return self.url + "/admin/api"

E TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

threescale_api/client.py:138: TypeError
=========================== short test summary info ============================
ERROR tests/integration/test_integration_service_subscriptions.py::test_list_service_subscriptions
ERROR tests/integration/test_integration_service_subscriptions.py::test_create_service_subscription
ERROR tests/integration/test_integration_service_subscriptions.py::test_read_service_subscription
ERROR tests/integration/test_integration_service_subscriptions.py::test_change_plan_service_subscription
ERROR tests/integration/test_integration_service_subscriptions.py::test_approve_service_subscription
============================== 5 errors in 0.24s ===============================
`

asserts.assert_resource(service_subscription)
asserts.assert_resource(account)
asserts.assert_resource(service_plan)
resource = account.service_subscriptions.approve(service_subscription.entity_id)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to simplified this line.

@mkudlej mkudlej merged commit 788fea9 into 3scale-qe:master Mar 6, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants