Skip to content

Commit

Permalink
Fix: tests with other language
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjiRS94 committed Mar 14, 2023
1 parent f5eafbd commit d65d0dd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
17 changes: 9 additions & 8 deletions tests/erp_service_testsuite.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@

existing_template = ns(
# An existing template with semantic id
erp_id = 183, # Extremely fragile
xml_id = 'giscedata_switching.notification_atr_M1_01',
name = 'ATR M101: Solicitud de modificación cambio de titular',
erp_id = 189, # Extremely fragile
xml_id = 'giscedata_switching.notification_atr_M1_06',
name = 'ATR M106: Solicitud de anulación al distribuidor',
model = 'giscedata.switching',
subject_ca_ES =
'Som Energia: Canvi de titular. Verificació de dades. '
'Contracte ${object.polissa_ref_id.name}',
subject_es_ES =
'Som Energia: Cambio de titular. Verificación de datos. '
'Contrato ${object.polissa_ref_id.name}',
'${object.company_id.name}: Sol·licitada anulació de la modificació de '
'contracte d\'accés la seva distribuidora ${object.partner_id.name}',
subject_es_ES =
'${object.company_id.name}: Solicitada anulación de la modificación de '
'contrato de acceso a su distribuidora ${object.partner_id.name}',
)
def edited_values(**kwds):
result = ns(
Expand Down Expand Up @@ -339,6 +339,7 @@ async def test__save_template__bodyTranslation_cloneMissingSupported(self, erp_s
'ca_ES': edited.def_body_text,
}

@pytest.mark.skip("In this moment, we don't want to add unsupported languages")
async def test__save_template__bodyTranslation_cloneExistingUnsupported(self, erp_service, erp_translations):
erp_translations.edit('def_body_text', 'en_US', dict(value='Former value'), create=True)

Expand Down
3 changes: 2 additions & 1 deletion tests/test_erp_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,14 @@ def __init__(self, erp):
self.model = 'poweremail.templates'

def list(self, field):
supported_languages = ['ca_ES', 'es_ES']
translations = self.erp.IrTranslation.read([
('name', '=', self.model+','+field),
('res_id', '=', existing_template.erp_id),
],['lang', 'value'])
return {
x['lang']: x['value']
for x in translations or []
for x in translations or [] if x['value'] and x['lang'] in supported_languages
}

def remove(self, field, lang):
Expand Down

1 comment on commit d65d0dd

@github-actions
Copy link

Choose a reason for hiding this comment

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

Tests Skipped Failures Errors Time
106 8 💤 0 ❌ 0 🔥 1m 13s ⏱️

Please sign in to comment.