~chicharreros/magicicada-server/trunk

« back to all changes in this revision

Viewing changes to magicicada/server/tests/test_server.py

  • Committer: Magicicada Bot
  • Author(s): Facundo Batista
  • Date: 2017-01-08 23:37:32 UTC
  • mfrom: (79.1.2 publicfiles)
  • Revision ID: magicicada_bot-20170108233732-faaeoq6sc9jorgue
[r=nataliabidart] Support public files changing and listing through the normal Server.

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
    Action,
49
49
    AuthenticateResponse,
50
50
    BytesMessageProducer,
 
51
    ChangePublicAccess,
51
52
    CreateShare,
52
53
    CreateUDF,
53
54
    DeleteShare,
56
57
    GetContentResponse,
57
58
    GetDeltaResponse,
58
59
    ListShares,
 
60
    ListPublicFiles,
59
61
    ListVolumes,
60
62
    LoopingPing,
61
63
    MakeResponse,
99
101
    last_modified = 2334524
100
102
    is_public = False
101
103
    path = u"path"
 
104
    volume_id = 'volumeid'
 
105
    public_url = 'public_url'
102
106
 
103
107
 
104
108
class FakeUser(object):
1177
1181
        self.assertEqual(self.response.length, 6)
1178
1182
 
1179
1183
 
 
1184
class ChangePublicAccessTestCase(SimpleRequestResponseTestCase):
 
1185
    """Test the ChangePublicAccess class."""
 
1186
 
 
1187
    response_class = ChangePublicAccess
 
1188
 
 
1189
 
 
1190
class ListPublicFilesTestCase(SimpleRequestResponseTestCase):
 
1191
    """Test the ListPublicFiles class."""
 
1192
 
 
1193
    response_class = ListPublicFiles
 
1194
 
 
1195
    @defer.inlineCallbacks
 
1196
    def test_process_set_values(self):
 
1197
        """Set length attribute and operation data while processing."""
 
1198
        mocker = Mocker()
 
1199
 
 
1200
        user = mocker.mock()
 
1201
        self.response.protocol.user = user
 
1202
 
 
1203
        nodes = [FakeNode(), FakeNode()]
 
1204
        expect(user.list_public_files()).result(nodes)
 
1205
 
 
1206
        with mocker:
 
1207
            yield self.response._process()
 
1208
 
 
1209
        self.assertEqual(self.response.length, 2)
 
1210
        self.assertEqual(self.response.operation_data, "public_files=2")
 
1211
 
 
1212
 
1180
1213
class UnlinkTestCase(SimpleRequestResponseTestCase):
1181
1214
    """Test the Unlink class."""
1182
1215