{"action":"created","comment":{"url":"https://api.github.com/repos/CanalTP/navitia/pulls/comments/52001269","id":52001269,"diff_hunk":"@@ -355,3 +361,174 @@ def test_vj_comment(self):\n                 notes_link = [l for l in date_time[\"links\"] if l[\"type\"] == \"notes\"]\n                 # assert that if it's the 'all' vj there is no note\n                 assert(len(vj_link) == 0 or len(notes_link) == 0)\n+\n+\n+StopSchedule = namedtuple('StopSchedule', ['sp', 'route', 'date_times'])\n+SchedDT = namedtuple('SchedDT', ['dt', 'vj'])\n+\n+Departure = namedtuple('Departure', ['sp', 'route', 'dt'])\n+\n+\n+def check_stop_schedule(response, reference):\n+    \"\"\"\n+    check the values in a stopschedule\n+    check the id of the stoppoint, the id of the routes, the datetimes and the vj used\n+\n+    Note: the stop_schedule are not sorted, we just must find all reference StopSchedule\n+    \"\"\"\n+    eq_(len(response), len(reference))\n+    for resp in response:\n+        ref = next(r for r in reference\n+                   if r.sp == get_not_null(get_not_null(resp, 'stop_point'), 'id')\n+                   and r.route == get_not_null(get_not_null(resp, 'route'), 'id'))\n+\n+        for (resp_dt, ref_st) in itertools.izip_longest(get_not_null(resp, 'date_times'), ref.date_times):\n+            eq_(get_not_null(resp_dt, 'date_time'), ref_st.dt)\n+            eq_(get_not_null(resp_dt, 'links')[0]['id'], ref_st.vj)\n+\n+\n+def check_departures(response, reference):\n+    \"\"\"\n+    check the values in a departures\n+    \"\"\"\n+    for (resp, ref) in itertools.izip_longest(response, reference):\n+        eq_(get_not_null(get_not_null(resp, 'stop_point'), 'id'), ref.sp)\n+        eq_(get_not_null(get_not_null(resp, 'route'), 'id'), ref.route)\n+        eq_(get_not_null(get_not_null(resp, 'stop_date_time'), 'departure_date_time'), ref.dt)\n+\n+\n+@dataset([\"basic_schedule_test\"])\n+class TestSchedules(AbstractTestFixture):\n+\n+    def test_classic_stop_schedule(self):\n+        \"\"\"default is Realtime stopschedule\"\"\"\n+        response = self.query_region(\"stop_points/S1/stop_schedules?from_datetime=20160101T080000\")\n+\n+        stop_sched = response[\"stop_schedules\"]\n+        is_valid_stop_schedule(stop_sched, self.tester)\n+\n+        self.check_stop_schedule_rt_sol(stop_sched)\n+\n+    def test_stop_schedule_base_schedule(self):\n+        response = self.query_region(\"stop_points/S1/stop_schedules?from_datetime=20160101T080000\"\n+                                     \"&data_freshness=base_schedule\")\n+\n+        stop_sched = response[\"stop_schedules\"]\n+        is_valid_stop_schedule(stop_sched, self.tester)\n+\n+        check_stop_schedule(stop_sched,\n+                            [StopSchedule(sp='S1', route='A:0',\n+                                          date_times=[SchedDT(dt='20160101T090000', vj='A:vj1'),\n+                                                      SchedDT(dt='20160101T100000', vj='A:vj2'),\n+                                                      SchedDT(dt='20160101T110000', vj='A:vj3')]),\n+                             StopSchedule(sp='S1', route='B:1',\n+                                          date_times=[SchedDT(dt='20160101T113000', vj='B:vj1')])])\n+\n+    @staticmethod\n+    def check_stop_schedule_rt_sol(stop_sched):\n+        check_stop_schedule(stop_sched,\n+                            [StopSchedule(sp='S1', route='A:0',\n+                                          date_times=[SchedDT(dt='20160101T090700',\n+                                                              vj='A:vj1:modified:0:delay_vj1'),\n+                                                      SchedDT(dt='20160101T100700',\n+                                                              vj='A:vj2:modified:0:delay_vj2'),\n+                                                      SchedDT(dt='20160101T110700',\n+                                                              vj='A:vj3:modified:0:delay_vj3')]),\n+                             StopSchedule(sp='S1', route='B:1',\n+                                          date_times=[SchedDT(dt='20160101T113000', vj='B:vj1')])])\n+\n+    def test_stop_schedule_realtime(self):\n+        \"\"\"\n+        test a stop schedule without a from_datetime parameter","path":"source/jormungandr/tests/departure_board_tests.py","position":196,"original_position":196,"commit_id":"58ad3f0aae334a6383a1d4acb6fbfcc08be2094b","original_commit_id":"f5a4d567bd42a63546f4e56b998287392f75dbac","user":{"login":"antoine-de","id":3987698,"avatar_url":"https://avatars.githubusercontent.com/u/3987698?v=3","gravatar_id":"","url":"https://api.github.com/users/antoine-de","html_url":"https://github.com/antoine-de","followers_url":"https://api.github.com/users/antoine-de/followers","following_url":"https://api.github.com/users/antoine-de/following{/other_user}","gists_url":"https://api.github.com/users/antoine-de/gists{/gist_id}","starred_url":"https://api.github.com/users/antoine-de/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antoine-de/subscriptions","organizations_url":"https://api.github.com/users/antoine-de/orgs","repos_url":"https://api.github.com/users/antoine-de/repos","events_url":"https://api.github.com/users/antoine-de/events{/privacy}","received_events_url":"https://api.github.com/users/antoine-de/received_events","type":"User","site_admin":false},"body":"yes you're right, thx!\n\nOn Fri, Feb 5, 2016 at 11:44 AM, pbougue <notifications@github.com> wrote:\n\n> In source/jormungandr/tests/departure_board_tests.py\n> <https://github.com/CanalTP/navitia/pull/1397#discussion_r52000795>:\n>\n> > +    @staticmethod\n> > +    def check_stop_schedule_rt_sol(stop_sched):\n> > +        check_stop_schedule(stop_sched,\n> > +                            [StopSchedule(sp='S1', route='A:0',\n> > +                                          date_times=[SchedDT(dt='20160101T090700',\n> > +                                                              vj='A:vj1:modified:0:delay_vj1'),\n> > +                                                      SchedDT(dt='20160101T100700',\n> > +                                                              vj='A:vj2:modified:0:delay_vj2'),\n> > +                                                      SchedDT(dt='20160101T110700',\n> > +                                                              vj='A:vj3:modified:0:delay_vj3')]),\n> > +                             StopSchedule(sp='S1', route='B:1',\n> > +                                          date_times=[SchedDT(dt='20160101T113000', vj='B:vj1')])])\n> > +\n> > +    def test_stop_schedule_realtime(self):\n> > +        \"\"\"\n> > +        test a stop schedule without a from_datetime parameter\n>\n> comment is not accurate I guess. You check that all is OK before testing\n> without dt, do you?\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/CanalTP/navitia/pull/1397/files#r52000795>.\n>\n","created_at":"2016-02-05T10:48:23Z","updated_at":"2016-02-05T10:48:23Z","html_url":"https://github.com/CanalTP/navitia/pull/1397#discussion_r52001269","pull_request_url":"https://api.github.com/repos/CanalTP/navitia/pulls/1397","_links":{"self":{"href":"https://api.github.com/repos/CanalTP/navitia/pulls/comments/52001269"},"html":{"href":"https://github.com/CanalTP/navitia/pull/1397#discussion_r52001269"},"pull_request":{"href":"https://api.github.com/repos/CanalTP/navitia/pulls/1397"}}},"pull_request":{"url":"https://api.github.com/repos/CanalTP/navitia/pulls/1397","id":58015313,"html_url":"https://github.com/CanalTP/navitia/pull/1397","diff_url":"https://github.com/CanalTP/navitia/pull/1397.diff","patch_url":"https://github.com/CanalTP/navitia/pull/1397.patch","issue_url":"https://api.github.com/repos/CanalTP/navitia/issues/1397","number":1397,"state":"open","locked":false,"title":"Jormun: no from_datetime => current datetime and realtime","user":{"login":"antoine-de","id":3987698,"avatar_url":"https://avatars.githubusercontent.com/u/3987698?v=3","gravatar_id":"","url":"https://api.github.com/users/antoine-de","html_url":"https://github.com/antoine-de","followers_url":"https://api.github.com/users/antoine-de/followers","following_url":"https://api.github.com/users/antoine-de/following{/other_user}","gists_url":"https://api.github.com/users/antoine-de/gists{/gist_id}","starred_url":"https://api.github.com/users/antoine-de/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antoine-de/subscriptions","organizations_url":"https://api.github.com/users/antoine-de/orgs","repos_url":"https://api.github.com/users/antoine-de/repos","events_url":"https://api.github.com/users/antoine-de/events{/privacy}","received_events_url":"https://api.github.com/users/antoine-de/received_events","type":"User","site_admin":false},"body":"linked to http://jira.canaltp.fr/browse/NAVP-275\r\n\r\n* add a data_freshness parameter to the schedules API\r\n* when no from_datetime is provided to those API, the current time is used (not 13h37 anymore), and the datafreshness (if not given) is set to realtime\r\n\r\n* pass the realtime_level to kraken (it was hard coded before)\r\n\r\nDO NOT merge, tests are coming","created_at":"2016-02-02T16:52:09Z","updated_at":"2016-02-05T10:48:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"65b1ef24bd016a56317dc346ea7a6fc3380ca371","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/CanalTP/navitia/pulls/1397/commits","review_comments_url":"https://api.github.com/repos/CanalTP/navitia/pulls/1397/comments","review_comment_url":"https://api.github.com/repos/CanalTP/navitia/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CanalTP/navitia/issues/1397/comments","statuses_url":"https://api.github.com/repos/CanalTP/navitia/statuses/58ad3f0aae334a6383a1d4acb6fbfcc08be2094b","head":{"label":"antoine-de:no_dt_param","ref":"no_dt_param","sha":"58ad3f0aae334a6383a1d4acb6fbfcc08be2094b","user":{"login":"antoine-de","id":3987698,"avatar_url":"https://avatars.githubusercontent.com/u/3987698?v=3","gravatar_id":"","url":"https://api.github.com/users/antoine-de","html_url":"https://github.com/antoine-de","followers_url":"https://api.github.com/users/antoine-de/followers","following_url":"https://api.github.com/users/antoine-de/following{/other_user}","gists_url":"https://api.github.com/users/antoine-de/gists{/gist_id}","starred_url":"https://api.github.com/users/antoine-de/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antoine-de/subscriptions","organizations_url":"https://api.github.com/users/antoine-de/orgs","repos_url":"https://api.github.com/users/antoine-de/repos","events_url":"https://api.github.com/users/antoine-de/events{/privacy}","received_events_url":"https://api.github.com/users/antoine-de/received_events","type":"User","site_admin":false},"repo":{"id":19144843,"name":"navitia","full_name":"antoine-de/navitia","owner":{"login":"antoine-de","id":3987698,"avatar_url":"https://avatars.githubusercontent.com/u/3987698?v=3","gravatar_id":"","url":"https://api.github.com/users/antoine-de","html_url":"https://github.com/antoine-de","followers_url":"https://api.github.com/users/antoine-de/followers","following_url":"https://api.github.com/users/antoine-de/following{/other_user}","gists_url":"https://api.github.com/users/antoine-de/gists{/gist_id}","starred_url":"https://api.github.com/users/antoine-de/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antoine-de/subscriptions","organizations_url":"https://api.github.com/users/antoine-de/orgs","repos_url":"https://api.github.com/users/antoine-de/repos","events_url":"https://api.github.com/users/antoine-de/events{/privacy}","received_events_url":"https://api.github.com/users/antoine-de/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/antoine-de/navitia","description":"","fork":true,"url":"https://api.github.com/repos/antoine-de/navitia","forks_url":"https://api.github.com/repos/antoine-de/navitia/forks","keys_url":"https://api.github.com/repos/antoine-de/navitia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/antoine-de/navitia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/antoine-de/navitia/teams","hooks_url":"https://api.github.com/repos/antoine-de/navitia/hooks","issue_events_url":"https://api.github.com/repos/antoine-de/navitia/issues/events{/number}","events_url":"https://api.github.com/repos/antoine-de/navitia/events","assignees_url":"https://api.github.com/repos/antoine-de/navitia/assignees{/user}","branches_url":"https://api.github.com/repos/antoine-de/navitia/branches{/branch}","tags_url":"https://api.github.com/repos/antoine-de/navitia/tags","blobs_url":"https://api.github.com/repos/antoine-de/navitia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/antoine-de/navitia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/antoine-de/navitia/git/refs{/sha}","trees_url":"https://api.github.com/repos/antoine-de/navitia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/antoine-de/navitia/statuses/{sha}","languages_url":"https://api.github.com/repos/antoine-de/navitia/languages","stargazers_url":"https://api.github.com/repos/antoine-de/navitia/stargazers","contributors_url":"https://api.github.com/repos/antoine-de/navitia/contributors","subscribers_url":"https://api.github.com/repos/antoine-de/navitia/subscribers","subscription_url":"https://api.github.com/repos/antoine-de/navitia/subscription","commits_url":"https://api.github.com/repos/antoine-de/navitia/commits{/sha}","git_commits_url":"https://api.github.com/repos/antoine-de/navitia/git/commits{/sha}","comments_url":"https://api.github.com/repos/antoine-de/navitia/comments{/number}","issue_comment_url":"https://api.github.com/repos/antoine-de/navitia/issues/comments{/number}","contents_url":"https://api.github.com/repos/antoine-de/navitia/contents/{+path}","compare_url":"https://api.github.com/repos/antoine-de/navitia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/antoine-de/navitia/merges","archive_url":"https://api.github.com/repos/antoine-de/navitia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/antoine-de/navitia/downloads","issues_url":"https://api.github.com/repos/antoine-de/navitia/issues{/number}","pulls_url":"https://api.github.com/repos/antoine-de/navitia/pulls{/number}","milestones_url":"https://api.github.com/repos/antoine-de/navitia/milestones{/number}","notifications_url":"https://api.github.com/repos/antoine-de/navitia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/antoine-de/navitia/labels{/name}","releases_url":"https://api.github.com/repos/antoine-de/navitia/releases{/id}","deployments_url":"https://api.github.com/repos/antoine-de/navitia/deployments","created_at":"2014-04-25T12:12:04Z","updated_at":"2015-04-30T13:08:16Z","pushed_at":"2016-02-05T10:25:25Z","git_url":"git://github.com/antoine-de/navitia.git","ssh_url":"git@github.com:antoine-de/navitia.git","clone_url":"https://github.com/antoine-de/navitia.git","svn_url":"https://github.com/antoine-de/navitia","homepage":"http://www.navitia.io/","size":28507,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"dev"}},"base":{"label":"CanalTP:dev","ref":"dev","sha":"19cf627eeafa5f4f0b28f72806cdf5ead6dcc811","user":{"login":"CanalTP","id":2743985,"avatar_url":"https://avatars.githubusercontent.com/u/2743985?v=3","gravatar_id":"","url":"https://api.github.com/users/CanalTP","html_url":"https://github.com/CanalTP","followers_url":"https://api.github.com/users/CanalTP/followers","following_url":"https://api.github.com/users/CanalTP/following{/other_user}","gists_url":"https://api.github.com/users/CanalTP/gists{/gist_id}","starred_url":"https://api.github.com/users/CanalTP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CanalTP/subscriptions","organizations_url":"https://api.github.com/users/CanalTP/orgs","repos_url":"https://api.github.com/users/CanalTP/repos","events_url":"https://api.github.com/users/CanalTP/events{/privacy}","received_events_url":"https://api.github.com/users/CanalTP/received_events","type":"Organization","site_admin":false},"repo":{"id":10797333,"name":"navitia","full_name":"CanalTP/navitia","owner":{"login":"CanalTP","id":2743985,"avatar_url":"https://avatars.githubusercontent.com/u/2743985?v=3","gravatar_id":"","url":"https://api.github.com/users/CanalTP","html_url":"https://github.com/CanalTP","followers_url":"https://api.github.com/users/CanalTP/followers","following_url":"https://api.github.com/users/CanalTP/following{/other_user}","gists_url":"https://api.github.com/users/CanalTP/gists{/gist_id}","starred_url":"https://api.github.com/users/CanalTP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CanalTP/subscriptions","organizations_url":"https://api.github.com/users/CanalTP/orgs","repos_url":"https://api.github.com/users/CanalTP/repos","events_url":"https://api.github.com/users/CanalTP/events{/privacy}","received_events_url":"https://api.github.com/users/CanalTP/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CanalTP/navitia","description":"The open source software to build responsive stuff with locomotion","fork":false,"url":"https://api.github.com/repos/CanalTP/navitia","forks_url":"https://api.github.com/repos/CanalTP/navitia/forks","keys_url":"https://api.github.com/repos/CanalTP/navitia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CanalTP/navitia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CanalTP/navitia/teams","hooks_url":"https://api.github.com/repos/CanalTP/navitia/hooks","issue_events_url":"https://api.github.com/repos/CanalTP/navitia/issues/events{/number}","events_url":"https://api.github.com/repos/CanalTP/navitia/events","assignees_url":"https://api.github.com/repos/CanalTP/navitia/assignees{/user}","branches_url":"https://api.github.com/repos/CanalTP/navitia/branches{/branch}","tags_url":"https://api.github.com/repos/CanalTP/navitia/tags","blobs_url":"https://api.github.com/repos/CanalTP/navitia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CanalTP/navitia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CanalTP/navitia/git/refs{/sha}","trees_url":"https://api.github.com/repos/CanalTP/navitia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CanalTP/navitia/statuses/{sha}","languages_url":"https://api.github.com/repos/CanalTP/navitia/languages","stargazers_url":"https://api.github.com/repos/CanalTP/navitia/stargazers","contributors_url":"https://api.github.com/repos/CanalTP/navitia/contributors","subscribers_url":"https://api.github.com/repos/CanalTP/navitia/subscribers","subscription_url":"https://api.github.com/repos/CanalTP/navitia/subscription","commits_url":"https://api.github.com/repos/CanalTP/navitia/commits{/sha}","git_commits_url":"https://api.github.com/repos/CanalTP/navitia/git/commits{/sha}","comments_url":"https://api.github.com/repos/CanalTP/navitia/comments{/number}","issue_comment_url":"https://api.github.com/repos/CanalTP/navitia/issues/comments{/number}","contents_url":"https://api.github.com/repos/CanalTP/navitia/contents/{+path}","compare_url":"https://api.github.com/repos/CanalTP/navitia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CanalTP/navitia/merges","archive_url":"https://api.github.com/repos/CanalTP/navitia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CanalTP/navitia/downloads","issues_url":"https://api.github.com/repos/CanalTP/navitia/issues{/number}","pulls_url":"https://api.github.com/repos/CanalTP/navitia/pulls{/number}","milestones_url":"https://api.github.com/repos/CanalTP/navitia/milestones{/number}","notifications_url":"https://api.github.com/repos/CanalTP/navitia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CanalTP/navitia/labels{/name}","releases_url":"https://api.github.com/repos/CanalTP/navitia/releases{/id}","deployments_url":"https://api.github.com/repos/CanalTP/navitia/deployments","created_at":"2013-06-19T15:34:30Z","updated_at":"2016-01-30T11:24:38Z","pushed_at":"2016-02-05T10:25:25Z","git_url":"git://github.com/CanalTP/navitia.git","ssh_url":"git@github.com:CanalTP/navitia.git","clone_url":"https://github.com/CanalTP/navitia.git","svn_url":"https://github.com/CanalTP/navitia","homepage":"http://www.navitia.io","size":33034,"stargazers_count":145,"watchers_count":145,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":53,"mirror_url":null,"open_issues_count":18,"forks":53,"open_issues":18,"watchers":145,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/CanalTP/navitia/pulls/1397"},"html":{"href":"https://github.com/CanalTP/navitia/pull/1397"},"issue":{"href":"https://api.github.com/repos/CanalTP/navitia/issues/1397"},"comments":{"href":"https://api.github.com/repos/CanalTP/navitia/issues/1397/comments"},"review_comments":{"href":"https://api.github.com/repos/CanalTP/navitia/pulls/1397/comments"},"review_comment":{"href":"https://api.github.com/repos/CanalTP/navitia/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CanalTP/navitia/pulls/1397/commits"},"statuses":{"href":"https://api.github.com/repos/CanalTP/navitia/statuses/58ad3f0aae334a6383a1d4acb6fbfcc08be2094b"}}}}