diff --git a/pythonpro/modules/templates/modules/module_detail.html b/pythonpro/modules/templates/modules/module_detail.html
index 7a938471..db77a2ce 100644
--- a/pythonpro/modules/templates/modules/module_detail.html
+++ b/pythonpro/modules/templates/modules/module_detail.html
@@ -1,6 +1,6 @@
{% extends 'core/base.html' %}
{% load static %}
-
+{% load permission_tags %}
{% block title %}{{ module.title }}{% endblock %}
{% block description %}{{ module.description }}{% endblock %}
@@ -15,7 +15,7 @@
{{ module.title }}
{{ module.objective }}
- {% if module.slug == 'python-birds' %}
+ {% if module.slug == 'python-birds' and user|has_role:'client,member' %}
Duração: 4 semanas
diff --git a/pythonpro/modules/tests/test_module_detail_view.py b/pythonpro/modules/tests/test_module_detail_view.py
index edd53c5d..a4176caa 100644
--- a/pythonpro/modules/tests/test_module_detail_view.py
+++ b/pythonpro/modules/tests/test_module_detail_view.py
@@ -3,7 +3,7 @@
from django.urls import reverse
from model_mommy import mommy
-from pythonpro.django_assertions import dj_assert_contains, dj_assert_template_used
+from pythonpro.django_assertions import dj_assert_contains, dj_assert_not_contains, dj_assert_template_used
from pythonpro.modules import facade
from pythonpro.modules.models import Chapter, Module, Section
@@ -41,6 +41,21 @@ def test_lead_content(content, client_with_lead, modules):
dj_assert_contains(resp, content)
+def test_lead_has_no_automation_button(client_with_lead, modules, python_birds):
+ resp = generate_resp('python-birds', client_with_lead)
+ dj_assert_not_contains(resp, reverse('modules:enrol', kwargs={'slug': python_birds.slug}))
+
+
+def test_client_has_no_automation_button(client_with_client, modules, python_birds):
+ resp = generate_resp('python-birds', client_with_client)
+ dj_assert_contains(resp, reverse('modules:enrol', kwargs={'slug': python_birds.slug}))
+
+
+def test_member_has_no_automation_button(client_with_member, modules, python_birds):
+ resp = generate_resp('python-birds', client_with_member)
+ dj_assert_contains(resp, reverse('modules:enrol', kwargs={'slug': python_birds.slug}))
+
+
@pytest.mark.parametrize(
'content',
[
@@ -124,10 +139,6 @@ def test_chapter_urls(resp_with_chapters, chapters):
dj_assert_contains(resp_with_chapters, chapter.get_absolute_url())
-def test_python_birds_enrol_link(resp_with_sections, python_birds):
- dj_assert_contains(resp_with_sections, reverse('modules:enrol', kwargs={'slug': python_birds.slug}))
-
-
def test_enrol_user_tags(python_birds, client_with_lead, mocker, logged_user):
tag_as = mocker.patch('pythonpro.modules.modules_views.tag_as')
resp = client_with_lead.get(reverse('modules:enrol', kwargs={'slug': python_birds.slug}), secure=True)