예제 #1
0
    def test_remove_topic_id_to_learn(self):
        """Testing remove_topic_id_to_learn."""
        learner_goals = (user_domain.LearnerGoals('user_id0', ['topic_id0'],
                                                  []))

        self.assertListEqual(learner_goals.topic_ids_to_learn, ['topic_id0'])

        learner_goals.remove_topic_id_from_learn('topic_id0')

        self.assertListEqual(learner_goals.topic_ids_to_learn, [])
예제 #2
0
    def test_add_topic_id_to_learn(self):
        """Testing add_topic_id_to_learn."""
        learner_goals = (user_domain.LearnerGoals('user_id0', ['topic_id0'],
                                                  []))

        self.assertListEqual(learner_goals.topic_ids_to_learn, ['topic_id0'])

        learner_goals.add_topic_id_to_learn('topic_id1')

        self.assertListEqual(learner_goals.topic_ids_to_learn,
                             ['topic_id0', 'topic_id1'])
예제 #3
0
def get_learner_goals_from_model(learner_goals_model):
    """Returns the learner goals domain object given the learner goals
    model loaded from the datastore.

    Args:
        learner_goals_model: LearnerGoalsModel. The
            learner goals model from the datastore.

    Returns:
        LearnerGoals. The learner goals domain object corresponding to the
        given model.
    """
    return user_domain.LearnerGoals(learner_goals_model.id,
                                    learner_goals_model.topic_ids_to_learn,
                                    learner_goals_model.topic_ids_to_master)
예제 #4
0
    def test_initialization(self):
        """Testing init method."""
        learner_goals = (user_domain.LearnerGoals('user_id0', ['topic_id0'],
                                                  []))

        self.assertListEqual(learner_goals.topic_ids_to_learn, ['topic_id0'])