From ea8014f88c77a183aba00643efc5a4eb5afd787d Mon Sep 17 00:00:00 2001
From: Martin Burchell <martinb@aptivate.org>
Date: Thu, 23 Jul 2015 11:02:40 +0100
Subject: [PATCH] Moved regions category into fixture

---
 .../website/rest_api/tests/counts_per_term_tests.py   | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

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 71690fcb..ca556ce4 100644
--- a/django/website/rest_api/tests/counts_per_term_tests.py
+++ b/django/website/rest_api/tests/counts_per_term_tests.py
@@ -31,8 +31,14 @@ def questions_category():
     return create_category("Test Ebola Questions").data
 
 
+@pytest.fixture
+def regions_category():
+    return create_category("Regions").data
+
+
 @pytest.mark.django_db
-def test_term_count_only_contains_terms_in_taxonomy(questions_category):
+def test_term_count_only_contains_terms_in_taxonomy(questions_category,
+                                                    regions_category):
     origin1 = create_item(body="What was the caused of ebola outbreak in liberia?").data
     origin2 = create_item(body="Is Ebola a man made sickness").data
     origin3 = create_item(body="What brought about ebola in liberia").data
@@ -46,8 +52,7 @@ def test_term_count_only_contains_terms_in_taxonomy(questions_category):
     victims = add_term(taxonomy=questions_category['slug'], name="Test Victims").data
     updates = add_term(taxonomy=questions_category['slug'], name="Test Updates").data
 
-    regions = create_category("Regions").data
-    monrovia = add_term(taxonomy=regions['slug'], name="Monrovia").data
+    monrovia = add_term(taxonomy=regions_category['slug'], name="Monrovia").data
 
     categorize_item(origin1, origins)
     categorize_item(origin2, origins)
-- 
GitLab