Git Fail Gracefully + gl_bot (major change)
Major update to anonticket/views.py and anonticket:
- Adds a new folder, gl_bot, which contains gitlabdown.py, a mocked version of the gitlab.GITLAB object to be called whenever a Timeout or ConnectTimeout error occurs when trying to fetch projects or issues from the Gitlab API.
- This allows the views/templates to display without errors (all required context objects created) without having to create a separate "GitLab is Down" view or dedicated 500 URL path/handler. Instead, the normal view is displayed, with context_data objects such as project and issue title rendering the "GitLab is Down" blocks as normal project/issue information.
- Templates for project_detail_view and issue_detail view have also been updated so that several blocks do not display in the event the GitLabDown Object is returned versus the normal GitLab object.
- A new battery of tests has been created inside of the gl_bot folder (gl_bot > tests.py) with mocked data from unittest.patch, which replaces the settings.GITLAB_URL with settings.TIMEOUT_URL when calling a gitlab object.
- All gitlab related functions in views.py have been moved from global gitlab object to discrete gitlab objects created within the functions to allow for better testing.
- Added a "table of contents" to tests.py including instructions on the combined testing (gitlab and normal tests) (both are run from manage.py)
- Deleted "lazy" calls - these are impossible to use with mocking without rewriting the standard gitlab.GITLAB object, because the object is already created and just returns nothing in the event of a Timeout.