summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorVictor Shyba <victor.shyba@gmail.com>2015-10-09 10:53:34 -0300
committerVictor Shyba <victor.shyba@gmail.com>2015-10-09 10:53:34 -0300
commite5f71398221334a145a16a1547194b25dee1ccdf (patch)
treec54971ec3f9c67d30a3f7bc8cec86212c6bd44ae /service
parent863212fcaeaa58ec84163103468227b4050f11ab (diff)
fixes test that wasnt running
Diffstat (limited to 'service')
-rw-r--r--service/test/unit/bitmask_libraries/test_soledad.py35
1 files changed, 20 insertions, 15 deletions
diff --git a/service/test/unit/bitmask_libraries/test_soledad.py b/service/test/unit/bitmask_libraries/test_soledad.py
index c4dfdafe..af2cfd0a 100644
--- a/service/test/unit/bitmask_libraries/test_soledad.py
+++ b/service/test/unit/bitmask_libraries/test_soledad.py
@@ -15,10 +15,10 @@
# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
from mock import patch
from pixelated.bitmask_libraries.soledad import SoledadSession
+from pixelated.bitmask_libraries.certs import LeapCertificate
from test_abstract_leap import AbstractLeapTest
-@patch('pixelated.bitmask_libraries.soledad.Soledad')
class SoledadSessionTest(AbstractLeapTest):
def setUp(self):
@@ -33,24 +33,29 @@ class SoledadSessionTest(AbstractLeapTest):
}
}}
- @patch('pixelated.bitmask_libraries.soledad.Soledad.__init__')
- def test_that_soledad_is_created_with_required_params(self, soledad_mock, init_mock):
+ @patch('pixelated.bitmask_libraries.soledad.Soledad')
+ 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
- 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)
-
+ 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)
+
+ @patch('pixelated.bitmask_libraries.soledad.Soledad')
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)
+ 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()
+ # when
+ soledad_session.sync()
- # then
- instance.sync.assert_called_with()
+ # then
+ instance.sync.assert_called_with()