~ubuntu-branches/ubuntu/trusty/desktopcouch/trusty

« back to all changes in this revision

Viewing changes to debian/patches/replication-exclusion.patch

  • Committer: Bazaar Package Importer
  • Author(s): Chad MILLER
  • Date: 2010-06-22 16:21:19 UTC
  • Revision ID: james.westby@ubuntu.com-20100622162119-3ebuc61x323kahha
Tags: 0.6.6-0ubuntu1
* New upstream release, 0.6.6. (There is no 0.6.5, except in the wild.)
* Resolve circular dependencies.  Group together dependent code in 
  'desktopcouch' package, and make transition packages of subpackages.
  Upstream will try decoupling properly in future.  (Debian: #571929)
* debian/patches/lp_522538.patch
  - No longer needed.  Removed.
* debian/patches/replication-exclusion.patch
  - No longer needed.  Removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
=== modified file 'desktopcouch/pair/couchdb_pairing/couchdb_io.py'
2
 
--- desktopcouch/pair/couchdb_pairing/couchdb_io.py     2010-04-12 19:24:14 +0000
3
 
+++ desktopcouch/pair/couchdb_pairing/couchdb_io.py     2010-04-15 14:56:36 +0000
4
 
@@ -212,7 +212,10 @@
5
 
         if key in record.value:  # EAFP, rather than LBYL?  Nones default?
6
 
             value = record.value[key]
7
 
             if value is not None:
8
 
-                values.append(value)
9
 
+                if "_order" in value:  # MergableList, so decode.
10
 
+                    values.append(value[k] for k in value["_order"])
11
 
+                else:
12
 
+                    values.append(value)
13
 
             else:
14
 
                 logging.debug("skipping record empty %s", key)
15
 
         else:
16
 
 
17
 
=== modified file 'desktopcouch/pair/tests/test_couchdb_io.py'
18
 
--- desktopcouch/pair/tests/test_couchdb_io.py  2009-11-12 22:05:09 +0000
19
 
+++ desktopcouch/pair/tests/test_couchdb_io.py  2010-04-15 14:56:36 +0000
20
 
@@ -23,6 +23,7 @@
21
 
 from desktopcouch.pair.couchdb_pairing import couchdb_io
22
 
 from desktopcouch.records.server import CouchDatabase
23
 
 from desktopcouch.records.record import Record
24
 
+from desktopcouch.replication_services import ubuntuone
25
 
 from twisted.trial import unittest
26
 
 import uuid
27
 
 import os
28
 
@@ -39,6 +40,9 @@
29
 
         self.foo_database = CouchDatabase('foo', create=True, uri=URI,
30
 
                 ctx=test_environment.test_context)
31
 
         #create some records to pull out and test
32
 
+        self.foo_database = CouchDatabase('bar', create=True, uri=URI,
33
 
+                ctx=test_environment.test_context)
34
 
+        #create some records to pull out and test
35
 
         self.foo_database.put_record(Record({
36
 
             "key1_1": "val1_1", "key1_2": "val1_2", "key1_3": "val1_3",
37
 
             "record_type": "test.com"}))
38
 
@@ -49,6 +53,15 @@
39
 
             "key13_1": "va31_1", "key3_2": "val3_2", "key3_3": "val3_3",
40
 
             "record_type": "test.com"}))
41
 
 
42
 
+        couchdb_io.put_static_paired_service({ 
43
 
+            "consumer_key": str("abcdef"),
44
 
+            "consumer_secret": str("ghighjklm"),
45
 
+            "token": str("opqrst"),
46
 
+            "token_secret": str("uvwxyz")}, "ubuntuone", uri=URI, 
47
 
+            ctx=test_environment.test_context)
48
 
+        excl = ubuntuone.ReplicationExclusion(ctx=test_environment.test_context)
49
 
+        excl.exclude("bar")
50
 
+
51
 
     def tearDown(self):
52
 
         """tear down each test"""
53
 
         del self.mgt_database._server['management']
54
 
@@ -95,7 +108,7 @@
55
 
                 uri=URI, ctx=test_environment.test_context)
56
 
 
57
 
         pairings = list(couchdb_io.get_pairings(ctx=test_environment.test_context))
58
 
-        self.assertEqual(3, len(pairings))
59
 
+        self.assertEqual(4, len(pairings))  #  3, plus 1 from setUp()
60
 
         self.assertEqual(pairings[0].value["oauth"], oauth_data)
61
 
         self.assertEqual(pairings[0].value["server"], hostname)
62
 
         self.assertEqual(pairings[0].value["pairing_identifier"], remote_uuid)
63
 
@@ -126,6 +139,7 @@
64
 
         names = couchdb_io.get_database_names_replicatable(uri=URI, ctx=test_environment.test_context)
65
 
         self.assertFalse('management' in names)
66
 
         self.assertTrue('foo' in names)
67
 
+        self.assertFalse('bar' in names, names)  # is excluded
68
 
 
69
 
     def test_get_my_host_unique_id(self):
70
 
         got = couchdb_io.get_my_host_unique_id(uri=URI, ctx=test_environment.test_context)
71