~ubuntuone-control-tower/ubuntuone-storage-protocol/stable-1-6

« back to all changes in this revision

Viewing changes to tests/test_putcontent.py

  • Committer: Tarmac
  • Author(s): Facundo Batista
  • Date: 2011-02-10 20:01:05 UTC
  • mfrom: (124.1.2 magic-hash)
  • Revision ID: tarmac-20110210200105-6k6wev47j7lbpm3p
The client now can send a magic hash in the PutContent request

Show diffs side-by-side

added added

removed removed

Lines of Context:
153
153
        pc_msg.ParseFromString(self.protocol.transport.value())
154
154
        self.assertEqual(pc_msg.put_content.upload_id, 'foo')
155
155
 
 
156
    def test_magic_hash_something(self):
 
157
        """Send magic hash in the PutContent."""
 
158
        pc = PutContent(self.protocol, 'share', 'node', '', '',
 
159
                        0, 0, 0, StringIO(''), magic_hash='foo')
 
160
        pc.start()
 
161
        pc_msg = protocol_pb2.Message()
 
162
        pc_msg.ParseFromString(self.protocol.transport.value())
 
163
        self.assertEqual(pc_msg.put_content.magic_hash, 'foo')
 
164
 
 
165
    def test_magic_hash_none(self):
 
166
        """Don't send magic hash in the PutContent."""
 
167
        pc = PutContent(self.protocol, 'share', 'node', '', '',
 
168
                        0, 0, 0, StringIO(''))
 
169
        pc.start()
 
170
        pc_msg = protocol_pb2.Message()
 
171
        pc_msg.ParseFromString(self.protocol.transport.value())
 
172
        self.assertEqual(pc_msg.put_content.magic_hash, '')