diff options
| author | Duda Dornelles <ddornell@thoughtworks.com> | 2014-10-09 12:03:31 +0200 | 
|---|---|---|
| committer | Duda Dornelles <ddornell@thoughtworks.com> | 2014-10-09 12:03:38 +0200 | 
| commit | 0bad14f4b0e6dd5128660d94a436463cbe7dc720 (patch) | |
| tree | 1c6170b1e29a09360378253da3fa3aeca9433641 /service/test/bitmask_libraries/soledad_test.py | |
| parent | e605929f9be56f01795fdc904d98cbe3f91984e3 (diff) | |
Changing tests folder structure
Diffstat (limited to 'service/test/bitmask_libraries/soledad_test.py')
| -rw-r--r-- | service/test/bitmask_libraries/soledad_test.py | 69 | 
1 files changed, 0 insertions, 69 deletions
| diff --git a/service/test/bitmask_libraries/soledad_test.py b/service/test/bitmask_libraries/soledad_test.py deleted file mode 100644 index 83a19fe1..00000000 --- a/service/test/bitmask_libraries/soledad_test.py +++ /dev/null @@ -1,69 +0,0 @@ -# -# Copyright (c) 2014 ThoughtWorks, Inc. -# -# Pixelated is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Pixelated is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with Pixelated. If not, see <http://www.gnu.org/licenses/>. -from mock import patch -from pixelated.bitmask_libraries.soledad import SoledadSession -from abstract_leap_test import AbstractLeapTest - - -@patch('pixelated.bitmask_libraries.soledad.Soledad') -class SoledadSessionTest(AbstractLeapTest): - -    def setUp(self): -        # given -        self.provider.fetch_soledad_json.return_value = {'hosts': { -            'couch1': { -                'hostname': 'couch1.some-server.test', -                'ip_address': '192.168.1.1', -                'port': 1234 -            } -        }} - -    @patch('pixelated.bitmask_libraries.soledad.Soledad.__init__') -    def test_that_soledad_is_created_with_required_params(self, soledad_mock, init_mock): -        # when -        SoledadSession(self.provider, 'any-passphrase', self.srp_session) - -        # then -        init_mock.assert_called_with(self.uuid, 'any-passphrase', '%s/soledad/%s.secret' % (self.leap_home, self.uuid), -                                     '%s/soledad/%s.db' % (self.leap_home, self.uuid), -                                     'https://couch1.some-server.test:1234/user-%s' % self.uuid, -                                     '/some/path/to/ca_cert', self.token) - -    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() - -    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.srp_session) - -            # when -            soledad_session.sync() - -            # then -            instance.need_sync.assert_called_with('/foo/bar') -            self.assertFalse(instance.sync.called) | 
