|
@@ -115,6 +115,19 @@ class ServiceTests(TestCase):
|
|
|
'subscriptions_count': -1,
|
|
|
})
|
|
|
|
|
|
+ def test_similar(self):
|
|
|
+ other_doc = Document.objects.create(name='other budget')
|
|
|
+ a = Service.objects.create(
|
|
|
+ name='Foo', document=self.doc, subscriptions_count=3)
|
|
|
+ b = Service.objects.create(
|
|
|
+ name='Foo', document=other_doc, subscriptions_count=3)
|
|
|
+ c = Service.objects.create(
|
|
|
+ name='Bar', document=other_doc, subscriptions_count=3)
|
|
|
+
|
|
|
+ similars = Service.objects.similar_to(a)
|
|
|
+ self.assertEqual(similars.count(), 1)
|
|
|
+ self.assertEqual(similars.first(), b)
|
|
|
+
|
|
|
|
|
|
class AbstractUseTests(TestCase):
|
|
|
""" Testing AbstractUseTests through CostUse
|