Merge lp://qastaging/~rick-rickspencer3/desktopcouch/selected_records_ids_test into lp://qastaging/desktopcouch

Proposed by Rick Spencer
Status: Merged
Approved by: Stuart Langridge
Approved revision: 87
Merged at revision: not available
Proposed branch: lp://qastaging/~rick-rickspencer3/desktopcouch/selected_records_ids_test
Merge into: lp://qastaging/desktopcouch
Diff against target: 42 lines
2 files modified
desktopcouch/records/couchgrid.py (+1/-1)
desktopcouch/records/tests/test_couchgrid.py (+19/-0)
To merge this branch: bzr merge lp://qastaging/~rick-rickspencer3/desktopcouch/selected_records_ids_test
Reviewer Review Type Date Requested Status
Stuart Langridge (community) Approve
Mark G. Saye (community) Approve
Review via email: mp+13178@code.qastaging.launchpad.net

Commit message

As promised, here is a test to catch bugs like bug #447512 that necessitated a small update.

To post a comment you must log in.
Revision history for this message
Rick Spencer (rick-rickspencer3) wrote :

Added test for CouchGrid to catch regressions related to the selected_record_ids property

Revision history for this message
Mark G. Saye (markgsaye) wrote :

Code change was already in trunk (got a criss-cross merge warning), but test code looks good, and all tests pass.

review: Approve
Revision history for this message
Stuart Langridge (sil) wrote :

Tests are good, yes they are

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'desktopcouch/records/couchgrid.py'
2--- desktopcouch/records/couchgrid.py 2009-08-22 17:22:02 +0000
3+++ desktopcouch/records/couchgrid.py 2009-10-10 22:50:21 +0000
4@@ -212,7 +212,7 @@
5 pass
6
7 #set the last value as the document_id, and append
8- row[-1] = r.key
9+ row[-1] = r.value["_id"]
10 self.list_store.append(row)
11
12 #apply the model tot he Treeview
13
14=== modified file 'desktopcouch/records/tests/test_couchgrid.py'
15--- desktopcouch/records/tests/test_couchgrid.py 2009-09-01 22:29:01 +0000
16+++ desktopcouch/records/tests/test_couchgrid.py 2009-10-10 22:50:21 +0000
17@@ -128,6 +128,25 @@
18 self.assertEqual(cw.get_model().get_n_columns(),4)
19 self.assertEqual(len(cw.get_model()),2)
20
21+ def test_selected_id_property(self):
22+ #create some records
23+ db = CouchDatabase(self.dbname, create=True)
24+ id1 = db.put_record(Record({
25+ "key1_1": "val1_1", "key1_2": "val1_2", "key1_3": "val1_3",
26+ "record_type": self.record_type}))
27+ id2 = db.put_record(Record({
28+ "key2_1": "val2_1", "key2_2": "val2_2", "key2_3": "val2_3",
29+ "record_type": self.record_type}))
30+
31+ #build the CouchGrid
32+ cw = CouchGrid(self.dbname)
33+ cw.record_type = self.record_type
34+ #make sure there are three columns and two rows
35+ cw.selected_record_ids = [id1]
36+ self.assertEqual(cw.selected_record_ids[0], id1)
37+ cw.selected_record_ids = [id2]
38+ self.assertEqual(cw.selected_record_ids[0], id2)
39+
40 def test_single_col_from_database(self):
41 #create some records
42 self.db.put_record(Record({

Subscribers

People subscribed via source and target branches