• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

allura


Commit MetaInfo

Revision76cf08e8741986d04c84d197f7d02396068c6677 (tree)
Time2011-04-29 00:34:05
AuthorDave Brondsema <dbrondsema@geek...>
CommiterWolf

Log Message

[#2019] with latest Ming, require ticket_num to always be present

Signed-off-by: Dave Brondsema <dbrondsema@geek.net>

Change Summary

Incremental Difference

--- a/ForgeTracker/forgetracker/model/ticket.py
+++ b/ForgeTracker/forgetracker/model/ticket.py
@@ -216,7 +216,7 @@ class Ticket(VersionedArtifact):
216216
217217 super_id = FieldProperty(schema.ObjectId, if_missing=None)
218218 sub_ids = FieldProperty([schema.ObjectId], if_missing=None)
219- ticket_num = FieldProperty(int)
219+ ticket_num = FieldProperty(int, required=True)
220220 summary = FieldProperty(str)
221221 description = FieldProperty(str, if_missing='')
222222 reported_by_id = ForeignIdProperty(User, if_missing=lambda:c.user._id)
--- a/ForgeTracker/forgetracker/tests/unit/test_ticket_model.py
+++ b/ForgeTracker/forgetracker/tests/unit/test_ticket_model.py
@@ -1,4 +1,6 @@
11 from ming.orm.ormsession import ThreadLocalORMSession
2+from ming import schema
3+from nose.tools import raises, assert_raises
24
35 from forgetracker.model import Ticket
46 from forgetracker.tests.unit import TrackerTestWithModel
@@ -7,8 +9,20 @@ from forgetracker.tests.unit import TrackerTestWithModel
79 class TestTicketModel(TrackerTestWithModel):
810 def test_that_it_has_ordered_custom_fields(self):
911 custom_fields = dict(my_field='my value')
10- Ticket(summary='my ticket', custom_fields=custom_fields)
12+ Ticket(summary='my ticket', custom_fields=custom_fields, ticket_num=3)
1113 ThreadLocalORMSession.flush_all()
1214 ticket = Ticket.query.get(summary='my ticket')
1315 assert ticket.custom_fields == dict(my_field='my value')
1416
17+ @raises(schema.Invalid)
18+ def test_ticket_num_required(self):
19+ Ticket(summary='my ticket')
20+
21+ def test_ticket_num_required2(self):
22+ t = Ticket(summary='my ticket', ticket_num=3)
23+ try:
24+ t.ticket_num = None
25+ except schema.Invalid:
26+ pass
27+ else:
28+ raise AssertionError('Expected schema.Invalid to be thrown')
--- a/requirements-common.txt
+++ b/requirements-common.txt
@@ -23,7 +23,7 @@ Mako==0.3.2
2323 Markdown==2.0.3
2424 MarkupSafe==0.11
2525 mercurial==1.4.1
26-Ming==0.2.1dev-20110412
26+Ming==0.2.1dev-20110428
2727 mock==0.6.0
2828 nose==0.11.3
2929 oauth2==1.2.0