示例#1
0
 def tearDown(self):
     """
     Need to explicitely invoke destruction on all bases.
     """
     self.db2.delete_database()
     SoledadWithCouchServerMixin.tearDown(self)
     tests.TestCaseWithServer.tearDown(self)
示例#2
0
    def setUp(self):
        SoledadWithCouchServerMixin.setUp(self)
        self.startTwistedServer()
        # config info
        self.db1_file = os.path.join(self.tempdir, "db1.u1db")
        os.unlink(self.db1_file)
        self.db_pass = DBPASS
        self.email = ADDRESS

        # get a random prefix for each test, so we do not mess with
        # concurrency during initialization and shutting down of
        # each local db.
        self.rand_prefix = ''.join(
            map(lambda x: random.choice(string.ascii_letters), range(6)))

        # open test dbs: db1 will be the local sqlcipher db (which
        # instantiates a syncdb). We use the self._soledad instance that was
        # already created on some setUp method.
        import binascii
        tohex = binascii.b2a_hex
        key = tohex(self._soledad.secrets.get_local_storage_key())
        sync_db_key = tohex(self._soledad.secrets.get_sync_db_key())
        dbpath = self._soledad._local_db_path

        self.opts = SQLCipherOptions(
            dbpath, key, is_raw_key=True, create=False,
            defer_encryption=True, sync_db_key=sync_db_key)
        self.db1 = SQLCipherDatabase(self.opts)

        self.db2 = self.request_state._create_database('test')
示例#3
0
 def setUp(self):
     tests.TestCaseWithServer.setUp(self)
     self.main_test_class = test_remote_sync_target.TestRemoteSyncTargets
     SoledadWithCouchServerMixin.setUp(self)
     self.startServer()
     self.db1 = make_sqlcipher_database_for_test(self, 'test1')
     self.db2 = self.request_state._create_database('test2')
示例#4
0
 def setUp(self):
     tests.TestCaseWithServer.setUp(self)
     self.main_test_class = test_remote_sync_target.TestRemoteSyncTargets
     SoledadWithCouchServerMixin.setUp(self)
     self.startServer()
     self.db1 = make_sqlcipher_database_for_test(self, 'test1')
     self.db2 = self.request_state._create_database('test2')
示例#5
0
    def setUp(self):
        SoledadWithCouchServerMixin.setUp(self)
        # config info
        self.db1_file = os.path.join(self.tempdir, "db1.u1db")
        os.unlink(self.db1_file)
        self.db_pass = DBPASS
        self.email = ADDRESS

        # get a random prefix for each test, so we do not mess with
        # concurrency during initialization and shutting down of
        # each local db.
        self.rand_prefix = ''.join(
            map(lambda x: random.choice(string.ascii_letters), range(6)))

        # open test dbs: db1 will be the local sqlcipher db (which
        # instantiates a syncdb). We use the self._soledad instance that was
        # already created on some setUp method.
        import binascii
        tohex = binascii.b2a_hex
        key = tohex(self._soledad.secrets.get_local_storage_key())
        sync_db_key = tohex(self._soledad.secrets.get_sync_db_key())
        dbpath = self._soledad._local_db_path

        self.opts = SQLCipherOptions(dbpath,
                                     key,
                                     is_raw_key=True,
                                     create=False,
                                     defer_encryption=True,
                                     sync_db_key=sync_db_key)
        self.db1 = SQLCipherDatabase(self.opts)

        self.db2 = couch.CouchDatabase.open_database(urljoin(
            'http://localhost:' + str(self.wrapper.port), 'test'),
                                                     create=True,
                                                     ensure_ddocs=True)
示例#6
0
 def tearDown(self):
     """
     Need to explicitely invoke destruction on all bases.
     """
     self.db2.delete_database()
     SoledadWithCouchServerMixin.tearDown(self)
     tests.TestCaseWithServer.tearDown(self)
示例#7
0
    def tearDown(self):
        self.db1.close()
        self.db2.close()
        self._soledad.close()

        # XXX should not access "private" attrs
        shutil.rmtree(os.path.dirname(self._soledad._local_db_path))
        SoledadWithCouchServerMixin.tearDown(self)
示例#8
0
    def tearDown(self):
        self.db1.close()
        self.db2.close()
        self._soledad.close()

        # XXX should not access "private" attrs
        shutil.rmtree(os.path.dirname(self._soledad._local_db_path))
        SoledadWithCouchServerMixin.tearDown(self)
示例#9
0
 def setUp(self):
     """
     Need to explicitely invoke inicialization on all bases.
     """
     SoledadWithCouchServerMixin.setUp(self)
     self.startTwistedServer()
     self.db = self.make_database_for_test(self, 'test1')
     self.db2 = self.request_state._create_database(replica_uid='test')
示例#10
0
 def setUp(self):
     """
     Need to explicitely invoke inicialization on all bases.
     """
     SoledadWithCouchServerMixin.setUp(self)
     self.startTwistedServer()
     self.db = self.make_database_for_test(self, 'test1')
     self.db2 = self.request_state._create_database(replica_uid='test')
示例#11
0
 def setUp(self):
     """
     Need to explicitely invoke inicialization on all bases.
     """
     SoledadWithCouchServerMixin.setUp(self)
     self.startTwistedServer()
     self.db = self.make_database_for_test(self, "test1")
     self.db2 = couch.CouchDatabase.open_database(
         urljoin("http://localhost:" + str(self.wrapper.port), "test"), create=True, ensure_ddocs=True
     )
示例#12
0
 def setUp(self):
     SoledadWithCouchServerMixin.setUp(self)
     creds = {
         'token': {
             'uuid': 'user-uuid',
             'token': 'auth-token',
         }
     }
     self.target = target.SoledadHTTPSyncTarget(self.couch_url,
                                                uuid4().hex, creds,
                                                self._soledad._crypto, None)
示例#13
0
 def setUp(self):
     """
     Need to explicitely invoke inicialization on all bases.
     """
     SoledadWithCouchServerMixin.setUp(self)
     self.startTwistedServer()
     self.db = self.make_database_for_test(self, 'test1')
     self.db2 = couch.CouchDatabase.open_database(urljoin(
         'http://localhost:' + str(self.wrapper.port), 'test'),
                                                  create=True,
                                                  ensure_ddocs=True)
示例#14
0
 def setUp(self):
     """
     Need to explicitely invoke inicialization on all bases.
     """
     tests.TestCaseWithServer.setUp(self)
     self.main_test_class = test_sync.TestDbSync
     SoledadWithCouchServerMixin.setUp(self)
     self.startServer()
     self.db2 = couch.CouchDatabase.open_database(urljoin(
         'http://localhost:' + str(self.wrapper.port), 'test'),
                                                  create=True,
                                                  ensure_ddocs=True)
示例#15
0
 def setUp(self):
     SoledadWithCouchServerMixin.setUp(self)
     creds = {'token': {
         'uuid': 'user-uuid',
         'token': 'auth-token',
     }}
     self.target = target.SoledadHTTPSyncTarget(
         self.couch_url,
         uuid4().hex,
         creds,
         self._soledad._crypto,
         None)
示例#16
0
 def setUp(self):
     SoledadWithCouchServerMixin.setUp(self)
     self._couch_url = 'http://localhost:' + str(self.wrapper.port)
     creds = {'token': {
         'uuid': 'user-uuid',
         'token': 'auth-token',
     }}
     self.target = target.SoledadHTTPSyncTarget(
         self._couch_url,
         uuid4().hex,
         creds,
         self._soledad._crypto,
         None)
示例#17
0
 def setUp(self):
     """
     Need to explicitely invoke inicialization on all bases.
     """
     tests.TestCaseWithServer.setUp(self)
     self.main_test_class = test_sync.TestDbSync
     SoledadWithCouchServerMixin.setUp(self)
     self.startServer()
     self.db2 = couch.CouchDatabase.open_database(
         urljoin(
             'http://localhost:' + str(self.wrapper.port), 'test'),
             create=True,
             ensure_ddocs=True)
示例#18
0
    def tearDown(self):
        """
        Need to explicitely invoke destruction on all bases.
        """
        dbsyncer = getattr(self, 'dbsyncer', None)
        if dbsyncer:
            dbsyncer.close()
        self.db1.close()
        self.db2.close()
        self._soledad.close()

        # XXX should not access "private" attrs
        shutil.rmtree(os.path.dirname(self._soledad._local_db_path))
        SoledadWithCouchServerMixin.tearDown(self)
示例#19
0
    def tearDown(self):
        """
        Need to explicitely invoke destruction on all bases.
        """
        dbsyncer = getattr(self, 'dbsyncer', None)
        if dbsyncer:
            dbsyncer.close()
        self.db1.close()
        self.db2.close()
        self._soledad.close()

        # XXX should not access "private" attrs
        shutil.rmtree(os.path.dirname(self._soledad._local_db_path))
        SoledadWithCouchServerMixin.tearDown(self)
示例#20
0
    def setUp(self):
        """
        Need to explicitely invoke inicialization on all bases.
        """
        SoledadWithCouchServerMixin.setUp(self)
        self.server = self.server_thread = None
        self.startServer()
        self.syncer = None

        # config info
        self.db1_file = os.path.join(self.tempdir, "db1.u1db")
        os.unlink(self.db1_file)
        self.db_pass = DBPASS
        self.email = ADDRESS

        # get a random prefix for each test, so we do not mess with
        # concurrency during initialization and shutting down of
        # each local db.
        self.rand_prefix = ''.join(
            map(lambda x: random.choice(string.ascii_letters), range(6)))

        # open test dbs: db1 will be the local sqlcipher db (which
        # instantiates a syncdb). We use the self._soledad instance that was
        # already created on some setUp method.
        import binascii
        tohex = binascii.b2a_hex
        key = tohex(self._soledad.secrets.get_local_storage_key())
        sync_db_key = tohex(self._soledad.secrets.get_sync_db_key())
        dbpath = self._soledad._local_db_path

        self.opts = SQLCipherOptions(
            dbpath, key, is_raw_key=True, create=False,
            defer_encryption=True, sync_db_key=sync_db_key)
        self.db1 = SQLCipherDatabase(self.opts)

        self.db2 = couch.CouchDatabase.open_database(
            urljoin(
                'http://localhost:' + str(self.wrapper.port), 'test'),
                create=True,
                ensure_ddocs=True)
示例#21
0
    def setUp(self):
        """
        Need to explicitely invoke inicialization on all bases.
        """
        SoledadWithCouchServerMixin.setUp(self)
        self.server = self.server_thread = None
        self.startTwistedServer()
        self.syncer = None

        # config info
        self.db1_file = os.path.join(self.tempdir, "db1.u1db")
        os.unlink(self.db1_file)
        self.db_pass = DBPASS
        self.email = ADDRESS

        # get a random prefix for each test, so we do not mess with
        # concurrency during initialization and shutting down of
        # each local db.
        self.rand_prefix = ''.join(
            map(lambda x: random.choice(string.ascii_letters), range(6)))

        # open test dbs: db1 will be the local sqlcipher db (which
        # instantiates a syncdb). We use the self._soledad instance that was
        # already created on some setUp method.
        import binascii
        tohex = binascii.b2a_hex
        key = tohex(self._soledad.secrets.get_local_storage_key())
        sync_db_key = tohex(self._soledad.secrets.get_sync_db_key())
        dbpath = self._soledad._local_db_path

        self.opts = SQLCipherOptions(dbpath,
                                     key,
                                     is_raw_key=True,
                                     create=False,
                                     defer_encryption=True,
                                     sync_db_key=sync_db_key)
        self.db1 = SQLCipherDatabase(self.opts)

        self.db2 = self.request_state._create_database(replica_uid='test')
示例#22
0
 def tearDown(self):
     """
     Need to explicitely invoke destruction on all bases.
     """
     SoledadWithCouchServerMixin.tearDown(self)
示例#23
0
 def tearDown(self):
     """
     Need to explicitely invoke destruction on all bases.
     """
     SoledadWithCouchServerMixin.tearDown(self)
示例#24
0
 def tearDown(self):
     # db2, _ = self.request_state.ensure_database('test2')
     self.delete_db(self.db2._dbname)
     self.db1.close()
     SoledadWithCouchServerMixin.tearDown(self)
     TestWithScenarios.tearDown(self)
示例#25
0
 def setUp(self):
     self.main_test_class = test_sync.TestDbSync
     SoledadWithCouchServerMixin.setUp(self)
示例#26
0
 def tearDown(self):
     SoledadWithCouchServerMixin.tearDown(self)
     tests.TestCaseWithServer.tearDown(self)
     db, _ = self.request_state.ensure_database('test2')
     db.delete_database()
示例#27
0
 def tearDown(self):
     SoledadWithCouchServerMixin.tearDown(self)
     tests.TestCaseWithServer.tearDown(self)
     db, _ = self.request_state.ensure_database('test2')
     db.delete_database()
示例#28
0
 def setUp(self):
     self.main_test_class = test_sync.DatabaseSyncTargetTests
     SoledadWithCouchServerMixin.setUp(self)
示例#29
0
 def setUp(self):
     tests.TestCaseWithServer.setUp(self)
     self.other_changes = []
     SoledadWithCouchServerMixin.setUp(self)
     self.db, self.st = make_local_db_and_soledad_target(self)
示例#30
0
 def setUp(self):
     self.main_test_class = test_sync.TestDbSync
     SoledadWithCouchServerMixin.setUp(self)
示例#31
0
 def tearDown(self):
     self.target.close()
     SoledadWithCouchServerMixin.tearDown(self)
示例#32
0
 def setUp(self):
     self.main_test_class = test_sync.DatabaseSyncTargetTests
     SoledadWithCouchServerMixin.setUp(self)
示例#33
0
 def setUp(self):
     TestWithScenarios.setUp(self)
     SoledadWithCouchServerMixin.setUp(self)
     self.startTwistedServer()
     self.db1 = make_sqlcipher_database_for_test(self, 'test1')
     self.db2 = self.request_state._create_database('test')
示例#34
0
 def tearDown(self):
     self.db.close()
     self.st.close()
     tests.TestCaseWithServer.tearDown(self)
     SoledadWithCouchServerMixin.tearDown(self)
示例#35
0
 def setUp(self):
     tests.TestCaseWithServer.setUp(self)
     self.other_changes = []
     SoledadWithCouchServerMixin.setUp(self)
     self.db, self.st = make_local_db_and_soledad_target(self)
示例#36
0
 def tearDown(self):
     # db2, _ = self.request_state.ensure_database('test2')
     self.delete_db(self.db2._dbname)
     self.db1.close()
     SoledadWithCouchServerMixin.tearDown(self)
     TestWithScenarios.tearDown(self)
示例#37
0
 def setUp(self):
     TestWithScenarios.setUp(self)
     SoledadWithCouchServerMixin.setUp(self)
     self.startTwistedServer()
     self.db1 = make_sqlcipher_database_for_test(self, 'test1')
     self.db2 = self.request_state._create_database('test')
示例#38
0
 def tearDown(self):
     self.target.close()
     SoledadWithCouchServerMixin.tearDown(self)
示例#39
0
 def tearDown(self):
     self.db.close()
     self.st.close()
     tests.TestCaseWithServer.tearDown(self)
     SoledadWithCouchServerMixin.tearDown(self)