Exemple #1
0
 def tearDown(self):
     """
     Need to explicitely invoke destruction on all bases.
     """
     self.db2.delete_database()
     SoledadWithCouchServerMixin.tearDown(self)
     tests.TestCaseWithServer.tearDown(self)
    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')
Exemple #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')
Exemple #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')
Exemple #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)
Exemple #6
0
 def tearDown(self):
     """
     Need to explicitely invoke destruction on all bases.
     """
     self.db2.delete_database()
     SoledadWithCouchServerMixin.tearDown(self)
     tests.TestCaseWithServer.tearDown(self)
    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)
Exemple #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)
Exemple #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')
Exemple #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')
Exemple #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
     )
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
 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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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')
Exemple #22
0
 def tearDown(self):
     """
     Need to explicitely invoke destruction on all bases.
     """
     SoledadWithCouchServerMixin.tearDown(self)
Exemple #23
0
 def tearDown(self):
     """
     Need to explicitely invoke destruction on all bases.
     """
     SoledadWithCouchServerMixin.tearDown(self)
Exemple #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)
Exemple #25
0
 def setUp(self):
     self.main_test_class = test_sync.TestDbSync
     SoledadWithCouchServerMixin.setUp(self)
Exemple #26
0
 def tearDown(self):
     SoledadWithCouchServerMixin.tearDown(self)
     tests.TestCaseWithServer.tearDown(self)
     db, _ = self.request_state.ensure_database('test2')
     db.delete_database()
Exemple #27
0
 def tearDown(self):
     SoledadWithCouchServerMixin.tearDown(self)
     tests.TestCaseWithServer.tearDown(self)
     db, _ = self.request_state.ensure_database('test2')
     db.delete_database()
Exemple #28
0
 def setUp(self):
     self.main_test_class = test_sync.DatabaseSyncTargetTests
     SoledadWithCouchServerMixin.setUp(self)
Exemple #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)
Exemple #30
0
 def setUp(self):
     self.main_test_class = test_sync.TestDbSync
     SoledadWithCouchServerMixin.setUp(self)
Exemple #31
0
 def tearDown(self):
     self.target.close()
     SoledadWithCouchServerMixin.tearDown(self)
Exemple #32
0
 def setUp(self):
     self.main_test_class = test_sync.DatabaseSyncTargetTests
     SoledadWithCouchServerMixin.setUp(self)
Exemple #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')
Exemple #34
0
 def tearDown(self):
     self.db.close()
     self.st.close()
     tests.TestCaseWithServer.tearDown(self)
     SoledadWithCouchServerMixin.tearDown(self)
Exemple #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)
Exemple #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)
Exemple #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')
Exemple #38
0
 def tearDown(self):
     self.target.close()
     SoledadWithCouchServerMixin.tearDown(self)
Exemple #39
0
 def tearDown(self):
     self.db.close()
     self.st.close()
     tests.TestCaseWithServer.tearDown(self)
     SoledadWithCouchServerMixin.tearDown(self)