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