GitHub PullRequestReviewCommentEvent at 2014-03-05 01:19:48
Repository: Bookie
Actor: mitechie
Payload: {"comment":{"url":"https://api.github.com/repos/bookieio/Bookie/pulls/comments/10284168","id":10284168,"diff_hunk":"@@ -451,6 +474,111 @@ def test_bookmark_tag_complete(self):\n             \"Should not have python as a tag completion: \" + res.body)\n         self._check_cors_headers(res)\n \n+    def test_start_defined_end(self):\n+        \"\"\"Test getting a user's bookmark count over a period of time when\n+        only start_date is defined and end_date is None\"\"\"\n+        test_dates = self._setup_user_bookmark_count()\n+        test_start_date = datetime(2013, 11, 16, 6, 6, 6)\n+        res = self.testapp.get(u'/api/v1/admin/stats/bmarkcount',\n+                               params={u'api_key': API_KEY,\n+                                       u'start_date': test_start_date},\n+                               status=200)\n+        data = json.loads(res.body)\n+        count = data['count'][0]\n+        self.assertEqual(\n+            count['attrib'], test_dates[0][0])\n+        self.assertEqual(\n+            count['data'], test_dates[0][1])\n+        self.assertEqual(\n+            count['tstamp'], str(test_dates[0][2]))\n+        # Test start_date and end_date.\n+        self.assertEqual(\n+            data['start_date'], str(test_start_date))\n+        self.assertEqual(\n+            data['end_date'], str(test_start_date + timedelta(days=30)))\n+\n+    def test_start_defined_end_defined(self):\n+        \"\"\"Test getting a user's bookmark count over a period of time when both\n+        start_date and end_date are defined\"\"\"\n+        test_dates = self._setup_user_bookmark_count()\n+        test_start_date = datetime(2013, 11, 14, 7, 7, 7)\n+        test_end_date = datetime(2013, 11, 16, 7, 7, 7)\n+        res = self.testapp.get(u'/api/v1/admin/stats/bmarkcount',\n+                               params={u'api_key': API_KEY,\n+                                       u'start_date': test_start_date,\n+                                       u'end_date': test_end_date},\n+                               status=200)\n+        data = json.loads(res.body)\n+        count = data['count'][0]\n+        self.assertEqual(\n+            count['attrib'], test_dates[1][0])\n+        self.assertEqual(\n+            count['data'], test_dates[1][1])\n+        self.assertEqual(\n+            count['tstamp'], str(test_dates[1][2]))\n+        # Test start_date and end_date.\n+        self.assertEqual(\n+            data['start_date'], str(test_start_date))\n+        self.assertEqual(\n+            data['end_date'], str(test_end_date))\n+\n+    def test_start_end_defined(self):\n+        \"\"\"Test getting a user's bookmark count over a period of time when\n+        start_date is None and end_date is defined\"\"\"\n+        test_dates = self._setup_user_bookmark_count()\n+        test_end_date = datetime(2013, 12, 29, 8, 8, 8)\n+        res = self.testapp.get(u'/api/v1/admin/stats/bmarkcount',\n+                               params={u'api_key': API_KEY,\n+                                       u'end_date': test_end_date},\n+                               status=200)\n+        data = json.loads(res.body)\n+        count = data['count'][0]\n+        self.assertEqual(\n+            count['attrib'], test_dates[2][0])\n+        self.assertEqual(\n+            count['data'], test_dates[2][1])\n+        self.assertEqual(\n+            count['tstamp'], str(test_dates[2][2]))\n+        # Test start_date and end_date.\n+        self.assertEqual(\n+            data['start_date'], str(test_end_date - timedelta(days=30)))\n+        self.assertEqual(\n+            data['end_date'], str(test_end_date))\n+\n+    def test_start_of_month(self):\n+        \"\"\"Test getting a user's bookmark count when start_date is the\n+        first day of the month\"\"\"\n+        test_dates = self._setup_user_bookmark_count()\n+        test_start_date = datetime(2013, 11, 1, 9, 9, 9)\n+        res = self.testapp.get(u'/api/v1/admin/stats/bmarkcount',\n+                               params={u'api_key': API_KEY,\n+                                       u'start_date': test_start_date},\n+                               status=200)\n+        data = json.loads(res.body)\n+        count = data['count']\n+        self.assertEqual(\n+            count[0]['attrib'], test_dates[1][0])\n+        self.assertEqual(\n+            count[0]['data'], test_dates[1][1])\n+        self.assertEqual(\n+            count[0]['tstamp'], str(test_dates[1][2]))\n+        self.assertEqual(\n+            count[1]['attrib'], test_dates[0][0])\n+        self.assertEqual(\n+            count[1]['data'], test_dates[0][1])\n+        self.assertEqual(\n+            count[1]['tstamp'], str(test_dates[0][2]))\n+        # Test start_date and end_date.\n+        self.assertEqual(\n+            data['start_date'], str(test_start_date))\n+        self.assertEqual(\n+            data['end_date'], str(datetime(2013, 11, 30, 9, 9, 9)))\n+\n+    def user_bookmark_count_authorization(self):","path":"bookie/tests/test_api/test_base_api.py","position":141,"original_position":141,"commit_id":"821547a49d156c359e59bef24ce5f55640518b4e","original_commit_id":"821547a49d156c359e59bef24ce5f55640518b4e","user":{"login":"mitechie","id":75915,"avatar_url":"https://gravatar.com/avatar/1641c0f988b844f44de596fcef3adc62?d=https%3A%2F%2Fidenticons.github.com%2F66777cfa12d147e4836069653448250b.png&r=x","gravatar_id":"1641c0f988b844f44de596fcef3adc62","url":"https://api.github.com/users/mitechie","html_url":"https://github.com/mitechie","followers_url":"https://api.github.com/users/mitechie/followers","following_url":"https://api.github.com/users/mitechie/following{/other_user}","gists_url":"https://api.github.com/users/mitechie/gists{/gist_id}","starred_url":"https://api.github.com/users/mitechie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitechie/subscriptions","organizations_url":"https://api.github.com/users/mitechie/orgs","repos_url":"https://api.github.com/users/mitechie/repos","events_url":"https://api.github.com/users/mitechie/events{/privacy}","received_events_url":"https://api.github.com/users/mitechie/received_events","type":"User","site_admin":false},"body":"this needs to start with test_ to get picked up as a test. ","created_at":"2014-03-05T01:19:48Z","updated_at":"2014-03-05T01:19:48Z","html_url":"https://github.com/bookieio/Bookie/pull/326#discussion_r10284168","pull_request_url":"https://api.github.com/repos/bookieio/Bookie/pulls/326","_links":{"self":{"href":"https://api.github.com/repos/bookieio/Bookie/pulls/comments/10284168"},"html":{"href":"https://github.com/bookieio/Bookie/pull/326#discussion_r10284168"},"pull_request":{"href":"https://api.github.com/repos/bookieio/Bookie/pulls/326"}}}}