2
# Author: Facundo Batista <facundo@canonical.com>
4
# Copyright 2010 Canonical Ltd.
6
# This program is free software: you can redistribute it and/or modify it
7
# under the terms of the GNU General Public License version 3, as published
8
# by the Free Software Foundation.
10
# This program is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranties of
12
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
13
# PURPOSE. See the GNU General Public License for more details.
15
# You should have received a copy of the GNU General Public License along
16
# with this program. If not, see <http://www.gnu.org/licenses/>.
18
"""Test the client code."""
20
from mocker import Mocker
21
from twisted.trial.unittest import TestCase
23
from ubuntuone.u1sync import client
26
class SyncStorageClientTest(TestCase):
27
"""Test the SyncStorageClient."""
29
def test_conn_made_call_parent(self):
30
"""The connectionMade method should call the parent."""
33
self.patch(client.StorageClient, 'connectionMade',
34
lambda s: called.append(True))
35
c = client.SyncStorageClient()
40
obj.current_protocol = c
41
obj.observer.connected()
47
self.assertTrue(called)
49
def test_conn_lost_call_parent(self):
50
"""The connectionLost method should call the parent."""
53
self.patch(client.StorageClient, 'connectionLost',
54
lambda s, r: called.append(True))
55
c = client.SyncStorageClient()
65
self.assertTrue(called)