Exemplo n.º 1
0
 def testBlipsRemoveWithId(self):
     blip_dict = {
         ROOT_BLIP_ID:
         self.new_blip(blipId=ROOT_BLIP_ID, childBlipIds=[CHILD_BLIP_ID]),
         CHILD_BLIP_ID:
         self.new_blip(blipId=CHILD_BLIP_ID, parentBlipId=ROOT_BLIP_ID)
     }
     blips = blip.Blips(blip_dict)
     blips._remove_with_id(CHILD_BLIP_ID)
     self.assertEqual(1, len(blips))
     self.assertEqual(0, len(blips[ROOT_BLIP_ID].child_blip_ids))
Exemplo n.º 2
0
    def __init__(self,
                 json,
                 blips,
                 root_thread,
                 operation_queue,
                 raw_deltas=None):
        """Inits this wavelet with JSON data.

    Args:
      json: JSON data dictionary from Wave server.
      blips: a dictionary object that can be used to resolve blips.
      root_thread: a BlipThread object containing the blips in the root thread.
      operation_queue: an OperationQueue object to be used to
        send any generated operations to.
    """
        self._operation_queue = operation_queue
        self._root_thread = root_thread
        self._wave_id = json.get('waveId')
        self._wavelet_id = json.get('waveletId')
        self._creator = json.get('creator')
        self._raw_deltas = raw_deltas
        self._raw_snapshot = json.get('rawSnapshot')
        self._creation_time = json.get('creationTime', 0)
        self._data_documents = DataDocs(json.get('dataDocuments',
                                                 {}), self._wave_id,
                                        self._wavelet_id, operation_queue)
        self._last_modified_time = json.get('lastModifiedTime')
        self._participants = Participants(json.get('participants', []),
                                          json.get('participantRoles',
                                                   {}), self._wave_id,
                                          self._wavelet_id, operation_queue)
        self._title = json.get('title', '')
        self._tags = Tags(json.get('tags', []), self._wave_id,
                          self._wavelet_id, operation_queue)

        self._raw_data = json
        self._blips = blip.Blips(blips)
        self._root_blip_id = json.get('rootBlipId')
        if self._root_blip_id and self._root_blip_id in self._blips:
            self._root_blip = self._blips[self._root_blip_id]
        else:
            self._root_blip = None
        self._robot_address = None