def test_initialization(self): """Testing init method.""" exp_last_playthrough = (user_domain.ExpUserLastPlaythrough( 'user_id0', 'exp_id0', 0, 'last_updated', 'state0')) self.assertEqual(exp_last_playthrough.id, 'user_id0.exp_id0') self.assertEqual(exp_last_playthrough.user_id, 'user_id0') self.assertEqual(exp_last_playthrough.exploration_id, 'exp_id0') self.assertEqual(exp_last_playthrough.last_played_exp_version, 0) self.assertEqual(exp_last_playthrough.last_updated, 'last_updated') self.assertEqual(exp_last_playthrough.last_played_state_name, 'state0')
def test_update_last_played_information(self): """Testing update_last_played_information.""" exp_last_playthrough = (user_domain.ExpUserLastPlaythrough( 'user_id0', 'exp_id0', 0, 'last_updated', 'state0')) self.assertEqual(exp_last_playthrough.last_played_exp_version, 0) self.assertEqual(exp_last_playthrough.last_played_state_name, 'state0') exp_last_playthrough.update_last_played_information(1, 'state1') self.assertEqual(exp_last_playthrough.last_played_exp_version, 1) self.assertEqual(exp_last_playthrough.last_played_state_name, 'state1')
def _get_last_playthrough_information(last_playthrough_model): """Returns an ExpUserLastPlaythrough domain object given an ExpUserLastPlaythroughModel loaded from the datastore. Args: last_playthrough_model: ExpUserLastPlaythroughModel. The last last playthrough information loaded from the datastore. Returns: ExpUserLastPlaythrough. The last playthrough information domain object corresponding to the given model. """ return user_domain.ExpUserLastPlaythrough( last_playthrough_model.user_id, last_playthrough_model.exploration_id, last_playthrough_model.last_played_exp_version, last_playthrough_model.last_updated, last_playthrough_model.last_played_state_name)