Skip to content

Commit

Permalink
(fix) Pas de signalement MP; tests (#3845)
Browse files Browse the repository at this point in the history
  • Loading branch information
vhf authored and GerardPaligot committed Oct 16, 2016
1 parent 9985d3a commit 0a53efe
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
2 changes: 2 additions & 0 deletions templates/misc/message.part.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
</form>
</li>
{% endif %}
{% if not is_mp %}
<li>
<a href="#signal-message-{{ message.id }}" class="ico-after alert open-modal">
{% trans "Signaler" %}
Expand All @@ -132,6 +133,7 @@
</button>
</form>
</li>
{% endif %}
</ul>
{% endif %}

Expand Down
2 changes: 1 addition & 1 deletion templates/mp/post/new.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
{% url "private-posts-new" topic.pk topic.slug %}?cite={{ message.pk }}
{% endcaptureas %}

{% include "misc/message.part.html" with can_hide=False %}
{% include "misc/message.part.html" with can_hide=False is_mp=True %}
{% endfor %}
</div>
{% endblock %}
2 changes: 1 addition & 1 deletion templates/mp/topic/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
{% set False as can_edit %}
{% endif %}

{% include "misc/message.part.html" with can_hide=False %}
{% include "misc/message.part.html" with can_hide=False is_mp=True %}
{% endfor %}
</div>

Expand Down
20 changes: 20 additions & 0 deletions zds/mp/tests/tests_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,26 @@ def test_get_page_too_far(self):
}) + '?page=42')
self.assertEqual(response.status_code, 404)

def test_available_actions(self):
"""we should be able to cite, but not hide or alert"""

login_check = self.client.login(
username=self.profile1.user.username,
password='hostel77'
)
self.assertTrue(login_check)

response = self.client.get(reverse('private-posts-list',
kwargs={'pk': self.topic1.pk,
'topic_slug': self.topic1.slug,
}))
# Citation button
self.assertContains(response, 'Citer')
# no Alert button
self.assertNotContains(response, 'Signaler')
# no Hide button
self.assertNotContains(response, 'Masquer')

def test_more_than_one_message(self):
""" test get second page """

Expand Down

0 comments on commit 0a53efe

Please sign in to comment.