예제 #1
0
    def test_that_sync_is_called(self, soledad_mock):
            instance = soledad_mock.return_value
            instance.server_url = '/foo/bar'
            soledad_session = SoledadSession(self.provider, 'any-passphrase', self.auth.token, self.auth.uuid)

            # when
            soledad_session.sync()

            # then
            instance.sync.assert_called_with()
예제 #2
0
    def test_that_sync_is_called(self, soledad_mock):
            instance = soledad_mock.return_value
            instance.server_url = '/foo/bar'
            soledad_session = SoledadSession(self.provider, 'any-passphrase', self.auth.token, self.auth.uuid)

            # when
            soledad_session.sync()

            # then
            instance.sync.assert_called_with()
예제 #3
0
    def test_that_sync_not_called_if_not_needed(self, mock):
            instance = mock.return_value
            instance.server_url = '/foo/bar'
            instance.need_sync.return_value = False
            soledad_session = SoledadSession(self.provider, 'any-passphrase', self.auth.token, self.auth.uuid)

            # when
            soledad_session.sync()

            # then
            instance.need_sync.assert_called_with('/foo/bar')
            self.assertFalse(instance.sync.called)
예제 #4
0
    def test_that_sync_is_called(self, soledad_mock):
            instance = soledad_mock.return_value
            instance.server_url = '/foo/bar'
            instance.need_sync.return_value = True
            soledad_session = SoledadSession(self.provider, 'any-passphrase', self.srp_session)

            # when
            soledad_session.sync()

            # then
            instance.need_sync.assert_called_with('/foo/bar')
            instance.sync.assert_called_with()
예제 #5
0
    def test_that_sync_is_called(self, soledad_mock):
        instance = soledad_mock.return_value
        instance.server_url = '/foo/bar'
        instance.need_sync.return_value = True
        soledad_session = SoledadSession(self.provider, 'any-passphrase',
                                         self.srp_session)

        # when
        soledad_session.sync()

        # then
        instance.need_sync.assert_called_with('/foo/bar')
        instance.sync.assert_called_with()
예제 #6
0
    def test_that_soledad_is_created_with_required_params(self, soledad_mock, init_mock):
        # when
        SoledadSession(self.provider, 'any-passphrase', self.auth.token, self.auth.uuid)

        # then
        init_mock.assert_called_with(self.auth.uuid, 'any-passphrase', '%s/soledad/%s.secret' % (self.leap_home, self.auth.uuid),
                                     '%s/soledad/%s.db' % (self.leap_home, self.auth.uuid),
                                     'https://couch1.some-server.test:1234/user-%s' % self.auth.uuid,
                                     '/some/path/to/ca_cert', self.token, defer_encryption=False)
예제 #7
0
    def test_that_soledad_is_created_with_required_params(self, soledad_mock):
        soledad_mock.return_value = None
        # when
        SoledadSession(self.provider, 'any-passphrase', self.auth.token,
                       self.auth.uuid)

        # then
        soledad_mock.assert_called_with(
            self.auth.uuid,
            passphrase=u'any-passphrase',
            secrets_path='%s/soledad/%s.secret' %
            (self.leap_home, self.auth.uuid),
            local_db_path='%s/soledad/%s.db' %
            (self.leap_home, self.auth.uuid),
            server_url='https://couch1.some-server.test:1234/user-%s' %
            self.auth.uuid,
            cert_file=LeapCertificate(self.provider).provider_api_cert,
            shared_db=None,
            auth_token=self.auth.token,
            defer_encryption=False)