Exemple #1
0
 def test_response_fields(self):
     cat = make_category(name="category_1")
     make_response(cat)
     response = self.client.get(reverse("canned_response:categories"))
     self.assertEqual(response.status_code, 200)
     self.assertCountEqual(response.data[0].keys(),
                           ("slug", "responses", "response_count", "name"))
     self.assertCountEqual(response.data[0]["responses"][0].keys(),
                           ("id", "text"))
Exemple #2
0
 def test_response_count(self):
     cat = make_category(name="category_1")
     make_response(cat)
     make_response(cat)
     make_response(cat)
     make_response(cat)
     response = self.client.get(reverse("canned_response:categories"))
     self.assertEqual(response.status_code, 200)
     self.assertEqual(response.data[0]["response_count"], 4)
 def test_response_fields(self):
     cat = make_category(name='category_1')
     make_response(cat)
     response = self.client.get(reverse('canned_response:categories'))
     self.assertEqual(response.status_code, 200)
     self.assertCountEqual(response.data[0].keys(),
                           ('slug', 'responses', 'response_count', 'name'))
     self.assertCountEqual(response.data[0]['responses'][0].keys(),
                           ('id', 'text'))
 def test_response_count(self):
     cat = make_category(name='category_1')
     make_response(cat)
     make_response(cat)
     make_response(cat)
     make_response(cat)
     response = self.client.get(reverse('canned_response:categories'))
     self.assertEqual(response.status_code, 200)
     self.assertEqual(response.data[0]['response_count'], 4)
Exemple #5
0
 def test_get_category_list(self):
     make_category(name="category_1")
     make_category(name="category_2")
     make_category(name="category_3")
     response = self.client.get(reverse("canned_response:categories"))
     self.assertEqual(response.status_code, 200)
     self.assertEqual(len(response.data), 3)