def _Test(client_id, timestamp, vp_dict, episode_id, ph_dict): ep_dict = { 'new_episode_id': episode_id, 'photo_ids': [ph_dict['photo_id']] if ph_dict is not None else [] } activity_id = Activity.ConstructActivityId(timestamp, 1, client_id) activity = self._RunAsync(Activity.CreateShareNew, self._client, user_id=self._test_user.user_id, viewpoint_id='v0', activity_id=activity_id, timestamp=timestamp, update_seq=0, ep_dicts=[ep_dict], follower_ids=[self._test_user2.user_id]) viewpoint, _ = self._RunAsync(Viewpoint.CreateNew, self._client, **vp_dict) if ph_dict is not None: photo = Photo.CreateFromKeywords(**ph_dict) self._RunAsync(photo.Update, self._client) viewpoint.cover_photo = { 'episode_id': episode_id, 'photo_id': photo.photo_id } return self._RunAsync(AlertManager._FormatAlertEmail, self._client, self._test_user2.user_id, viewpoint, activity)
def _CreateTestPhoto(self, ph_dict): """Create photo for testing purposes.""" photo = Photo.CreateFromKeywords(**ph_dict) self._RunAsync(photo.Update, self._client)