def test_robot_updated(self):
        affected_refs = {
            'team': {ndb.Key(Team, 'frc254'), ndb.Key(Team, 'frc604')},
        }
        cache_keys = [q.cache_key for q in get_affected_queries.robot_updated(affected_refs)]

        self.assertEqual(len(cache_keys), 2)
        self.assertTrue(TeamRobotsQuery('frc254').cache_key in cache_keys)
        self.assertTrue(TeamRobotsQuery('frc604').cache_key in cache_keys)
Пример #2
0
    def _render(self, team_key):
        self._set_team(team_key)

        robots = TeamRobotsQuery(self.team_key).fetch()

        robots_dict = {robot.year: ModelToDict.robotConverter(robot) for robot in robots}
        return json.dumps(robots_dict, ensure_ascii=True)
Пример #3
0
def robot_updated(affected_refs):
    team_keys = filter(None, affected_refs['team'])

    queries_and_keys = []
    for team_key in team_keys:
        queries_and_keys.append((TeamRobotsQuery(team_key.id())))

    return queries_and_keys
    def _render(self, team_key):
        robots, self._last_modified = TeamRobotsQuery(team_key).fetch(dict_version=3, return_updated=True)

        return json.dumps(robots, ensure_ascii=True, indent=2, sort_keys=True)