Skip to content

Commit

Permalink
Merge pull request #91 from cloudblue/bug/LITE-28430-no-icon-on-account
Browse files Browse the repository at this point in the history
LITE-28430: Setting in null logo if the account doesn't have an icon
  • Loading branch information
d3rky authored Aug 17, 2023
2 parents 91d09f1 + fcb252e commit 5c7846f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion connect_ext_ppr/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def upsert_account(db, account_data):
account = Account(id=account_data['id'])

account.name = account_data['name']
account.logo = account_data['icon']
account.logo = account_data.get('icon')
db.add(account)
db.commit()

Expand Down
20 changes: 19 additions & 1 deletion tests/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@

from connect_ext_ppr.models.deployment import Deployment, MarketplaceConfiguration
from connect_ext_ppr.models.file import File
from connect_ext_ppr.models.replicas import Account
from connect_ext_ppr.schemas import FileSchema, PPRVersionCreateSchema
from connect_ext_ppr.service import add_deployments, create_ppr, get_ppr_new_version
from connect_ext_ppr.service import add_deployments, create_ppr, get_ppr_new_version, upsert_account


def test_add_one_deployments(
Expand Down Expand Up @@ -382,3 +383,20 @@ def test_create_ppr_db_error(
assert ex.value.message == (
"Object `MFL-6390-1110-0832` already exists, cannot create a new one."
)


@pytest.mark.parametrize(
'account_data',
(
{'id': 'VA-000-000', 'name': 'I am a vendor', 'icon': 'my_avatar.png'},
{'id': 'VA-000-000', 'name': 'I am a vendor'},
),
)
def test_upsert_account(dbsession, account_data):

upsert_account(dbsession, account_data)
account = dbsession.query(Account).first()

assert account.id == account_data['id']
assert account.name == account_data['name']
assert account.logo == account_data.get('icon')

0 comments on commit 5c7846f

Please sign in to comment.