コード例 #1
0
    def testForAncestor(self):
        """Tests that proper connections are returned."""
        query = connection_logic.queryForAncestor(self.profile.key)
        # exhaust the query to check what entities are fetched
        connections = query.fetch(1000)
        self.assertSetEqual(
            set(connection.key for connection in connections),
            set([self.first_connection.key, self.third_connection.key]))

        query = connection_logic.queryForAncestor(self.other_profile.key)
        # exhaust the query to check what entities are fetched
        connections = query.fetch(1000)
        self.assertSetEqual(set(connection.key for connection in connections),
                            set([self.second_connection.key]))

        third_profile = profile_utils.seedNDBProfile(self.program.key())
        query = connection_logic.queryForAncestor(third_profile.key)
        # exhaust the query to check what entities are fetched
        connections = query.fetch(1000)
        self.assertSetEqual(set(connections), set())
コード例 #2
0
  def testForAncestor(self):
    """Tests that proper connections are returned."""
    query = connection_logic.queryForAncestor(self.profile.key)
    # exhaust the query to check what entities are fetched
    connections = query.fetch(1000)
    self.assertSetEqual(
        set(connection.key for connection in connections),
        set([self.first_connection.key, self.third_connection.key]))

    query = connection_logic.queryForAncestor(self.other_profile.key)
    # exhaust the query to check what entities are fetched
    connections = query.fetch(1000)
    self.assertSetEqual(
        set(connection.key for connection in connections),
        set([self.second_connection.key]))

    third_profile = profile_utils.seedNDBProfile(self.program.key())
    query = connection_logic.queryForAncestor(third_profile.key)
    # exhaust the query to check what entities are fetched
    connections = query.fetch(1000)
    self.assertSetEqual(set(connections), set())
コード例 #3
0
 def _getQuery(self):
   """See ConnectionList._getQuery for specification."""
   return connection_logic.queryForAncestor(self.data.ndb_profile.key)