Skip to content

Commit

Permalink
AAP-27258: improve the visual when the Trial has expired (#1365)
Browse files Browse the repository at this point in the history
Return a better message with an URL pointing on IBM's Lightspeed website.
  • Loading branch information
goneri authored Oct 23, 2024
1 parent d8afb47 commit c7c50d1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
6 changes: 1 addition & 5 deletions ansible_ai_connect/main/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,7 @@ def test_get_view_expired_trial(self):
r = self.client.get(reverse("me_summary"))
self.assertEqual(r.status_code, 200)
content = r.json()["content"]
expectation = """
Logged in as: test_user_name<br>
Your trial period has expired.
"""
self.assertEqual(dedent(expectation).strip(), content)
self.assertTrue("Your trial has expired. Contact your Red Hat" in content)

user.delete()
trial_plan.delete()
Expand Down
6 changes: 5 additions & 1 deletion ansible_ai_connect/users/one_click_trial.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ def get_markdown(self, host):
elif expired_plan:
markdown_value = f"""
Logged in as: {self.user.username}<br>
Your trial period has expired.
Your trial has expired. Contact your Red Hat Organization's
administrator to request access to
<a href =
"https://www.ibm.com/products/watsonx-code-assistant-ansible-lightspeed">
Ansible Lightspeed with IBM watsonx Code Assistant</a>.
"""
else:
markdown_value = f"""
Expand Down
7 changes: 6 additions & 1 deletion ansible_ai_connect/users/templates/users/trial.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ <h1 class="pf-c-title pf-m-lg">{{ project_name }}</h1>

{% elif has_expired_plan %}
<div class="ls_message_body">
<p>Your trial period has expired</p>
<p>
Your trial has expired. Contact your Red Hat Organization's administrator to request access to
<a href =
"https://www.ibm.com/products/watsonx-code-assistant-ansible-lightspeed">
Ansible Lightspeed with IBM watsonx Code Assistant</a>.
</p>
</div>
{% else %}
<form action={% url 'trial' %} method="post">{% csrf_token %}
Expand Down
2 changes: 1 addition & 1 deletion ansible_ai_connect/users/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ def test_trial_period_is_done(self):
)
self.user.plans.add(trial_plan)
r = self.client.get(reverse("trial"))
self.assertContains(r, "Your trial period has expired")
self.assertContains(r, "Your trial has expired. Contact your Red Hat")

@override_settings(SEGMENT_WRITE_KEY="blablabla")
def test_accept_trial_schema1(self):
Expand Down

0 comments on commit c7c50d1

Please sign in to comment.