Projet

Général

Profil

0001-sms-increase-visibility-of-test-message-sending-5813.patch

Valentin Deniaud, 28 octobre 2021 18:36

Télécharger (2,99 ko)

Voir les différences:

Subject: [PATCH] sms: increase visibility of test message sending (#58138)

 .../passerelle/manage/messages_service_view.html       |  9 ++-------
 .../templates/passerelle/manage/service_view.html      |  2 ++
 tests/test_sms.py                                      | 10 ++++------
 3 files changed, 8 insertions(+), 13 deletions(-)
passerelle/sms/templates/passerelle/manage/messages_service_view.html
1 1
{% extends "passerelle/manage/service_view.html" %}
2 2
{% load i18n passerelle %}
3 3

  
4
{% block endpoints %}
5
{{ block.super }}
4
{% block actions %}
6 5
{% if perms.base.see_accessright %}
7
<div>
8
  <a rel="popup" href="/manage{{ object.get_absolute_url }}test-send/">
9
    {% trans 'Send a test message' %}
10
  </a>
11
</div>
6
<a rel="popup" id="sms-test-send" href="/manage{{ object.get_absolute_url }}test-send/">{% trans 'Send a test message' %}</a>
12 7
{% endif %}
13 8
{% endblock %}
passerelle/templates/passerelle/manage/service_view.html
19 19
{% if object|can_edit:request.user %}
20 20
<a rel="popup" href="{{ object.get_edit_url }}">{% trans 'edit' %}</a>
21 21
{% endif %}
22
{% block actions %}
23
{% endblock %}
22 24
</span>
23 25
<ul class="extra-actions-menu">
24 26
  {% if object|can_edit:request.user and has_check_status %}
tests/test_sms.py
422 422
def test_sms_test_send(admin_user, app, connector):
423 423
    url = '/%s/%s/' % (connector.get_connector_slug(), connector.slug)
424 424
    resp = app.get(url)
425
    link = resp.html.find('div', {'id': 'endpoints'}).find_all('a')[-1]
426
    assert 'Send a test message' not in link.text
425
    assert 'Send a test message' not in resp.text
427 426

  
428 427
    app = login(app)
429 428
    resp = app.get(url)
430
    link = resp.html.find('div', {'id': 'endpoints'}).find_all('a')[-1]
431
    assert 'Send a test message' in link.text
432
    assert link['href'] == reverse(
429
    assert 'Send a test message' in resp.text
430
    assert resp.pyquery('a#sms-test-send')[0].attrib['href'] == reverse(
433 431
        'sms-test-send', kwargs={'connector': connector.get_connector_slug(), 'slug': connector.slug}
434 432
    )
435 433

  
436
    resp = app.get(link['href'])
434
    resp = resp.click('Send a test message')
437 435
    resp.form['number'] = '+33688888888'
438 436
    resp.form['sender'] = '+33699999999'
439 437
    resp.form['message'] = 'hello'
440
-