Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
21
Issues
21
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SRCT
go
Commits
ef18dac9
Unverified
Commit
ef18dac9
authored
Mar 28, 2017
by
David Haynes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Silly style changes pls ignore
- Over time I get annoyed with how I formatted things in the past
parent
fd14c2ef
Pipeline
#1165
passed with stage
in 1 minute and 11 seconds
Changes
13
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
52 additions
and
36 deletions
+52
-36
go/go/cas_callbacks.py
go/go/cas_callbacks.py
+1
-1
go/go/forms.py
go/go/forms.py
+6
-5
go/go/management/commands/expirelinks.py
go/go/management/commands/expirelinks.py
+2
-2
go/go/management/commands/test_expirelinks.py
go/go/management/commands/test_expirelinks.py
+3
-3
go/go/templatetags/go_extras.py
go/go/templatetags/go_extras.py
+6
-6
go/go/templatetags/test_go_extras.py
go/go/templatetags/test_go_extras.py
+3
-3
go/go/test_cas_callbacks.py
go/go/test_cas_callbacks.py
+0
-1
go/go/test_forms.py
go/go/test_forms.py
+2
-2
go/go/test_models.py
go/go/test_models.py
+5
-1
go/go/test_views.py
go/go/test_views.py
+1
-1
go/go/views.py
go/go/views.py
+7
-6
go/settings/test_urls.py
go/settings/test_urls.py
+9
-3
go/settings/urls.py
go/settings/urls.py
+7
-2
No files found.
go/go/cas_callbacks.py
View file @
ef18dac9
...
...
@@ -7,8 +7,8 @@ from __future__ import (absolute_import, division, print_function,
unicode_literals
)
# Django Imports
from
django.contrib.auth.models
import
User
from
django.conf
import
settings
from
django.contrib.auth.models
import
User
# Other Imports
import
requests
...
...
go/go/forms.py
View file @
ef18dac9
...
...
@@ -13,18 +13,19 @@ from six.moves import urllib
# Django Imports
from
django
import
forms
from
django.core.exceptions
import
ValidationError
from
django.utils.safestring
import
mark_safe
from
django.utils
import
timezone
from
django.utils.safestring
import
mark_safe
# App Imports
from
go.models
import
URL
,
RegisteredUser
# Other Imports
from
crispy_forms.helper
import
FormHelper
from
crispy_forms.layout
import
Layout
,
Fieldset
,
Submit
,
HTML
,
Div
,
Field
from
crispy_forms.bootstrap
import
(
StrictButton
,
PrependedText
,
Accordion
,
AccordionGroup
)
from
bootstrap3_datetime.widgets
import
DateTimePicker
from
crispy_forms.bootstrap
import
(
Accordion
,
AccordionGroup
,
PrependedText
,
StrictButton
)
from
crispy_forms.helper
import
FormHelper
from
crispy_forms.layout
import
HTML
,
Div
,
Field
,
Fieldset
,
Layout
,
Submit
class
URLForm
(
forms
.
ModelForm
):
"""
...
...
go/go/management/commands/expirelinks.py
View file @
ef18dac9
...
...
@@ -6,7 +6,6 @@ go/commands/expirelinks.py
from
__future__
import
(
absolute_import
,
division
,
print_function
,
unicode_literals
)
# Django Imports
from
django.core.management.base
import
BaseCommand
from
django.utils
import
timezone
...
...
@@ -25,7 +24,8 @@ class Command(BaseCommand):
def
handle
(
self
,
*
args
,
**
options
):
"""
The handle function handles the main component of the django-admin command.
The handle function handles the main component of the django-admin
command.
"""
# Loop through a list of all URL objects that have expired
...
...
go/go/management/commands/test_expirelinks.py
View file @
ef18dac9
...
...
@@ -10,13 +10,12 @@ from __future__ import (absolute_import, division, print_function,
from
datetime
import
timedelta
# Django Imports
from
django.test
import
TestCase
from
django.contrib.auth.models
import
User
from
django.utils
import
timezone
from
django.core.management
import
call_command
from
django.test
import
TestCase
from
django.utils
import
timezone
# App Imports
from
.expirelinks
import
Command
from
go.models
import
URL
,
RegisteredUser
class
ExpireLinksTest
(
TestCase
):
...
...
@@ -49,6 +48,7 @@ class ExpireLinksTest(TestCase):
current_url
.
expires
=
yesterday
second_url
.
expires
=
tomorrow
current_url
.
save
()
second_url
.
save
()
def
test_expirelinks
(
self
):
"""
...
...
go/go/templatetags/go_extras.py
View file @
ef18dac9
...
...
@@ -20,10 +20,10 @@ register = template.Library()
@
register
.
filter
def
is_registered
(
given_user
):
"""
Helper template function to check if a user is registered.
Helper template function to check if a user is registered.
given_user: The User object that we are checking to see if they are registered
or not.
given_user: The User object that we are checking to see if they are
registered
or not.
"""
# try getting the RegisteredUser of the current user
...
...
@@ -40,10 +40,10 @@ def is_registered(given_user):
@
register
.
filter
def
is_approved
(
given_user
):
"""
Helper template function to check if a user is approved.
Helper template function to check if a user is approved.
given_user: The User object that we are checking to see if they are approved
or not.
given_user: The User object that we are checking to see if they are approved
or not.
"""
# try getting the RegisteredUser of the current user
...
...
go/go/templatetags/test_go_extras.py
View file @
ef18dac9
...
...
@@ -7,12 +7,12 @@ from __future__ import (absolute_import, division, print_function,
unicode_literals
)
# Django Imports
from
django.test
import
TestCase
from
django.contrib.auth.models
import
User
from
django.test
import
TestCase
# App Imports
from
.go_extras
import
is_registered
,
is_approved
from
go.models
import
RegisteredUser
from
.go_extras
import
is_approved
,
is_registered
class
GoExtrasTest
(
TestCase
):
"""
...
...
@@ -30,7 +30,7 @@ class GoExtrasTest(TestCase):
def
test_is_registered_false
(
self
):
"""
Test the is_registered function to see if it gives correct false
Test the is_registered function to see if it gives correct false
answers
"""
...
...
go/go/test_cas_callbacks.py
View file @
ef18dac9
...
...
@@ -13,7 +13,6 @@ class CasCallbacksTest(TestCase):
Test cases for the functions in call_callbacks.
"""
def
test_pf_peoplefinder_method
(
self
):
"""
Presently enrolled student who has been added to peoplefinder
...
...
go/go/test_forms.py
View file @
ef18dac9
...
...
@@ -13,11 +13,11 @@ from __future__ import (absolute_import, division, print_function,
from
datetime
import
datetime
,
timedelta
# Django Imports
from
django.test
import
TestCase
from
django.contrib.auth.models
import
User
from
django.test
import
TestCase
# App Imports
from
go.forms
import
URLForm
,
Signup
Form
from
go.forms
import
SignupForm
,
URL
Form
from
go.models
import
URL
,
RegisteredUser
class
URLFormTest
(
TestCase
):
...
...
go/go/test_models.py
View file @
ef18dac9
"""
go/test_models.py
"""
# Future Imports
from
__future__
import
(
absolute_import
,
division
,
print_function
,
unicode_literals
)
# Django Imports
from
django.test
import
TestCase
from
django.contrib.auth.models
import
User
from
django.db.utils
import
DataError
,
IntegrityError
from
django.test
import
TestCase
from
django.utils
import
timezone
# App Imports
...
...
go/go/test_views.py
View file @
ef18dac9
...
...
@@ -10,8 +10,8 @@ from __future__ import (absolute_import, division, print_function,
unicode_literals
)
# Django Imports
from
django.test
import
TestCase
,
Client
from
django.contrib.auth.models
import
User
from
django.test
import
TestCase
,
Client
# App Imports
from
go.models
import
URL
,
RegisteredUser
...
...
go/go/views.py
View file @
ef18dac9
...
...
@@ -11,21 +11,22 @@ from datetime import timedelta
# Django Imports
from
django.conf
import
settings
from
django.contrib.auth
import
REDIRECT_FIELD_NAME
from
django.contrib.auth.decorators
import
login_required
,
user_passes_test
from
django.core.exceptions
import
PermissionDenied
# ValidationError
from
django.core.mail
import
EmailMessage
,
send_mail
from
django.http
import
HttpResponseServerError
# Http404
from
django.http
import
HttpResponseRedirect
from
django.shortcuts
import
get_object_or_404
,
redirect
,
render
from
django.utils
import
timezone
from
django.core.exceptions
import
PermissionDenied
# ValidationError
from
django.core.mail
import
send_mail
,
EmailMessage
from
django.contrib.auth
import
REDIRECT_FIELD_NAME
from
django.contrib.auth.decorators
import
user_passes_test
,
login_required
from
django.shortcuts
import
render
,
get_object_or_404
,
redirect
# Other imports
from
ratelimit.decorators
import
ratelimit
# App Imports
from
go.forms
import
SignupForm
,
URLForm
from
go.models
import
URL
,
RegisteredUser
from
go.forms
import
URLForm
,
SignupForm
def
index
(
request
):
"""
...
...
go/settings/test_urls.py
View file @
ef18dac9
"""
settings/test_urls.py
References:
- https://stackoverflow.com/questions/18987051/how-do-i-unit-test-django-urls
"""
# Future Imports
from
__future__
import
unicode_literals
,
absolute_import
,
print_function
,
division
from
__future__
import
(
absolute_import
,
division
,
print_function
,
unicode_literals
)
# Django Imports
from
django.test
import
TestCase
from
django.urls
import
reverse
# https://stackoverflow.com/questions/18987051/how-do-i-unit-test-django-urls
class
UrlsTest
(
TestCase
):
"""
Test cases for the urls
...
...
go/settings/urls.py
View file @
ef18dac9
"""
settings/urls.py
"""
# Future Imports
from
__future__
import
unicode_literals
,
absolute_import
,
print_function
,
division
from
__future__
import
(
absolute_import
,
division
,
print_function
,
unicode_literals
)
# Django Imports
from
django.conf.urls
import
url
import
django.contrib.auth.views
from
django.conf.urls
import
url
from
django.contrib
import
admin
from
django.views.decorators.cache
import
cache_page
from
django.views.generic
import
TemplateView
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment