Exemplo n.º 1
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')
Exemplo n.º 2
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.local_key)
        dbpath = self._soledad._local_db_path

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

        self.db2 = self.request_state._create_database(replica_uid='test')
Exemplo n.º 3
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')
Exemplo n.º 4
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)
Exemplo n.º 5
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)
Exemplo n.º 6
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')
Exemplo n.º 7
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)
Exemplo n.º 8
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')
 def setUp(self):
     SoledadWithCouchServerMixin.setUp(self)
     TestCaseWithServer.setUp(self)