def testChangeNarrativePlace(self): logoutCurrentUser() setCurrentUser("*****@*****.**", "User1") register_new_user('User1') place1 = create_place("Place 1") place2 = create_place("Place 2") role1 = create_role("Role 1") role2 = create_role("Role 2") create_presence(role1, place1) create_presence(role2, place2) set_playing(role1) create_narrative(place1, "Narrative 1 from Role 1 at Place 1") rset = get_first_narrative() self.assertEqual(len(rset["narrative"]), 1) narrative = rset["narrative"][0] set_playing(role2) rset = get_first_narrative() self.assertEqual(len(rset["narrative"]), 0) set_playing(role1) create_presence(role1, place2) save_narrative(narrative["id"], place_id=place2) rset = get_first_narrative() self.assertEqual(len(rset["narrative"]), 1) set_playing(role2) rset = get_first_narrative() self.assertEqual(len(rset["narrative"]), 1)
def testChangeNarrativeBody(self): logoutCurrentUser() setCurrentUser("*****@*****.**", "User1") register_new_user('User1') place1 = create_place("Place 1") role1 = create_role("Role 1") create_presence(role1, place1) set_playing(role1) create_narrative(place1, "Narrative 1 from Role 1 at Place 1") rset = get_first_narrative() self.assertEqual(rset["more"], False) self.assertEqual(len(rset["narrative"]), 1) narrative = rset["narrative"][0] self.assertEqual(narrative["role"], "Role 1") self.assertEqual(narrative["place"], "Place 1") self.assertEqual(narrative["body"], "Narrative 1 from Role 1 at Place 1") self.assertIsNotNone(narrative["created"]) self.assertIsNone(narrative["updated"]) save_narrative(narrative["id"], "Narrative 1 from Role 1 at Place 1 - updated") rset = get_first_narrative() self.assertEqual(rset["more"], False) self.assertEqual(len(rset["narrative"]), 1) narrative = rset["narrative"][0] self.assertEqual(narrative["role"], "Role 1") self.assertEqual(narrative["place"], "Place 1") self.assertEqual(narrative["body"], "Narrative 1 from Role 1 at Place 1 - updated") self.assertIsNotNone(narrative["created"]) self.assertIsNotNone(narrative["updated"])