예제 #1
0
    def test_get_id_from_name(self):
        """Test converting state names to ids."""
        id_1 = "123"
        name_1 = "State 1"
        State.create(self.exploration, name_1, state_id=id_1)
        self.assertEqual(State._get_id_from_name(name_1, self.exploration), id_1)

        with self.assertRaises(Exception):
            State._get_id_from_name("fake_name", self.exploration)

        self.assertEqual(State._get_id_from_name(feconf.END_DEST, self.exploration), feconf.END_DEST)