Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix some tests

  • Loading branch information...
commit 6fd3d5bd22ac53adeeae3f1a558e7023d086bba6 1 parent 197370c
@ofri authored
Showing with 14 additions and 5 deletions.
  1. +13 −4 laws/tests.py
  2. +1 −1  simple/tests.py
View
17 laws/tests.py
@@ -1,5 +1,5 @@
# encoding: utf-8
-from datetime import date,datetime
+from datetime import date, datetime, timedelta
import urllib
from django.test import TestCase
from django.conf import settings
@@ -15,7 +15,7 @@
import unittest
from laws.models import Vote,Law, Bill,KnessetProposal, BillBudgetEstimation
-from mks.models import Member, Party, Membership
+from mks.models import Member, Party, Membership, Knesset
from agendas.models import Agenda, AgendaVote
just_id = lambda x: x.id
@@ -24,6 +24,11 @@
class BillViewsTest(TestCase):
def setUp(self):
+
+ d = date.today()
+ self.knesset = Knesset.objects.create(
+ number=1,
+ start_date=d - timedelta(10))
self.vote_1 = Vote.objects.create(time=datetime.now(),
title='vote 1')
self.vote_2 = Vote.objects.create(time=datetime.now(),
@@ -81,8 +86,8 @@ def test_bill_list_with_nonexisting_member(self):
res = self.client.get(reverse('bill-list'), {'member':'0'})
self.assertEqual(res.status_code,404)
- def testBillListByBooklet(self):
- res = self.client.get(reverse('bill-list'), {'booklet': '2'})
+ def testBillListByKnessetBooklet(self):
+ res = self.client.get(reverse('bill-list'), {'knesset_booklet': '2'})
object_list = res.context['object_list']
self.assertEqual(map(just_id, object_list), [self.bill_1.id])
@@ -518,6 +523,10 @@ def tearDown(self):
class APIv2Test(TestCase):
def setUp(self):
+ d = date.today()
+ self.knesset = Knesset.objects.create(
+ number=1,
+ start_date=d - timedelta(10))
self.url_prefix = '/api/v2'
self.vote_1 = Vote.objects.create(time=datetime.now(),
title='vote 1')
View
2  simple/tests.py
@@ -27,7 +27,7 @@ def test_parse_knesset_bill_pdf_text(self):
self.assertEqual(results[0]['date'], expected_date)
expected_title = "הצעת חוק האזרחות (תיקון מס' 10) (ביטול אזרחות בשל הרשעה בעבירה), התשע\"א1102".decode('utf8')
self.assertEqual(results[0]['title'], expected_title)
- expected_original = u'2377/18/\u05e4'
+ expected_original = u'2377/18'
self.assertEqual(results[0]['original_ids'][0], expected_original)
expected_title = "הצעת חוק הביטוח הלאומי (תיקון מס' 126) (הארכת התכנית הניסיונית), התשע\"א1102".decode('utf8')
self.assertEqual(results[3]['title'], expected_title)
Please sign in to comment.
Something went wrong with that request. Please try again.