Example #1
0
 def test_active_should_raise_error_on_not_ok_status(self, rerquest_mock):
     # arrange
     with client(events_url=GITHUB_EVENTS_URL_MASK,
                 commits_url=GITHUB_COMMITS_URL_MASK,
                 pages_allowed=10).app_context():
         # action
         self.assertRaises(Exception, Api().active, 'user')
Example #2
0
 def test_downwards_should_raise_error_on_unknown_user(self, rerquest_mock):
     # arrange
     with client(events_url=GITHUB_EVENTS_URL_MASK,
                 commits_url=GITHUB_COMMITS_URL_MASK,
                 pages_allowed=10).app_context():
         # action
         self.assertRaises(Exception, Api().downwards, 'unknown', 'repo')
Example #3
0
 def test_downwards_should_return_false_on_additions_more_than_deletions(
         self, rerquest_mock):
     # arrange
     with client(events_url=GITHUB_EVENTS_URL_MASK,
                 commits_url=GITHUB_COMMITS_URL_MASK,
                 pages_allowed=10).app_context():
         # action
         self.assertFalse(Api().downwards('user', 'repo'))
Example #4
0
 def test_active_should_return_raise_error_if_there_are_no_push_events_and_date_is_missing(
         self, rerquest_mock):
     # arrange
     with client(events_url=GITHUB_EVENTS_URL_MASK,
                 commits_url=GITHUB_COMMITS_URL_MASK,
                 pages_allowed=10).app_context():
         # action
         # assert
         self.assertRaises(Exception, Api().active, 'user')
Example #5
0
 def test_active_should_return_true_if_there_are_push_events_among_other_events(
         self, rerquest_mock):
     # arrange
     with client(events_url=GITHUB_EVENTS_URL_MASK,
                 commits_url=GITHUB_COMMITS_URL_MASK,
                 pages_allowed=10).app_context():
         # action
         result = Api().active('user')
         # assert
         self.assertTrue(result)
Example #6
0
 def test_active_should_return_false_if_there_are_push_events_not_within_last_twenty_four_hours(
         self, rerquest_mock):
     # arrange
     with client(events_url=GITHUB_EVENTS_URL_MASK,
                 commits_url=GITHUB_COMMITS_URL_MASK,
                 pages_allowed=10).app_context():
         # action
         result = Api().active('user')
         # assert
         self.assertFalse(result)