def setUp(self): self.test_wave_data = TEST_WAVE_DATA.copy() self.test_wavelet_data = TEST_WAVELET_DATA.copy() self.test_blip_data = TEST_BLIP_DATA.copy() self.wave = model.Wave(self.test_wave_data) self.wavelet = model.Wavelet(self.test_wavelet_data) self.blip = model.Blip(self.test_blip_data) self.test_context = model.Context() self.test_context.waves[self.wave.waveId] = self.wave self.test_context.wavelets[self.wavelet.waveletId] = self.wavelet self.test_context.blips[self.blip.blipId] = self.blip
def testBlipFields(self): b = model.Blip(self.test_blip_data, model.Document(self.test_blip_data)) self.assertEquals(self.test_blip_data.child_blip_ids, b.GetChildBlipIds()) self.assertEquals(self.test_blip_data.contributors, b.GetContributors()) self.assertEquals(self.test_blip_data.creator, b.GetCreator()) self.assertEquals(self.test_blip_data.content, b.GetDocument().GetText()) self.assertEquals(self.test_blip_data.blip_id, b.GetId()) self.assertEquals(self.test_blip_data.last_modified_time, b.GetLastModifiedTime()) self.assertEquals(self.test_blip_data.parent_blip_id, b.GetParentBlipId()) self.assertEquals(self.test_blip_data.wave_id, b.GetWaveId()) self.assertEquals(self.test_blip_data.wavelet_id, b.GetWaveletId()) self.assertEquals(True, b.IsRoot())
def testDefaults(self): empty_json = {} self.verifySameAttributes(self.blip, model.Blip(empty_json)) self.verifySameAttributes(self.wave, model.Wave(empty_json)) self.verifySameAttributes(self.wavelet, model.Wavelet(empty_json))
def testDocument(self): b = model.Blip(self.test_blip_data) doc = model.Document(b) self.assertEquals(b.content, doc.GetText())
def testBlipIsNotRoot(self): self.test_blip_data['parentBlipId'] = 'blip-parent' b = model.Blip(self.test_blip_data) self.assertEquals(False, b.IsRoot())
def testBlipIsRoot(self): self.test_blip_data.parent_blip_id = 'blip-parent' b = model.Blip(self.test_blip_data, model.Document(self.test_blip_data)) self.assertEquals(False, b.IsRoot())