From ee55db40b50a0594f9d85b58690524004626de79 Mon Sep 17 00:00:00 2001
From: Martin Burchell <martinb@aptivate.org>
Date: Thu, 23 Jul 2015 11:50:03 +0100
Subject: [PATCH] Added test for wrong taxonomy not in term count

---
 .../rest_api/tests/counts_per_term_tests.py      | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/django/website/rest_api/tests/counts_per_term_tests.py b/django/website/rest_api/tests/counts_per_term_tests.py
index d25f03fd..8f1979e0 100644
--- a/django/website/rest_api/tests/counts_per_term_tests.py
+++ b/django/website/rest_api/tests/counts_per_term_tests.py
@@ -89,6 +89,22 @@ def test_term_count_contains_taxonomy_term_name(questions_category):
     assert origins['name'] == name
 
 
+@pytest.mark.django_db
+def test_term_count_does_not_contain_term_for_other_taxonomy(
+        questions_category, regions_category):
+    origin1 = create_item(body="What was the caused of ebola outbreak in liberia?").data
+    origins = add_term(taxonomy=questions_category['slug'], name="Test Origins").data
+    monrovia = add_term(taxonomy=regions_category['slug'], name="Monrovia").data
+
+    categorize_item(origin1, origins)
+    categorize_item(origin1, monrovia)
+
+    terms = get_term_count(questions_category).data
+    names = [term['name'] for term in terms]
+
+    assert monrovia['name'] not in names
+
+
 @pytest.mark.django_db
 def test_term_count_contains_taxonomy_term_long_name(questions_category):
     origin1 = create_item(body="What was the caused of ebola outbreak in liberia?").data
-- 
GitLab