Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CSCI 40 Midterm Project
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Lance Michael O. Co
CSCI 40 Midterm Project
Commits
90a9d7a1
Commit
90a9d7a1
authored
Mar 13, 2020
by
Lance Michael O. Co
😢
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made into CBVs
parent
1d4e3403
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
41 additions
and
25 deletions
+41
-25
tests.cpython-38.pyc
froyo/__pycache__/tests.cpython-38.pyc
+0
-0
urls.cpython-38.pyc
froyo/__pycache__/urls.cpython-38.pyc
+0
-0
views.cpython-38.pyc
froyo/__pycache__/views.cpython-38.pyc
+0
-0
home.html
froyo/templates/home.html
+3
-0
task_create_form.html
froyo/templates/task_create_form.html
+3
-0
task_form.html
froyo/templates/task_form.html
+3
-0
tests.py
froyo/tests.py
+5
-6
urls.py
froyo/urls.py
+5
-2
views.py
froyo/views.py
+9
-4
functional_test.py
functional_test.py
+13
-13
No files found.
froyo/__pycache__/tests.cpython-38.pyc
View file @
90a9d7a1
No preview for this file type
froyo/__pycache__/urls.cpython-38.pyc
View file @
90a9d7a1
No preview for this file type
froyo/__pycache__/views.cpython-38.pyc
View file @
90a9d7a1
No preview for this file type
froyo/templates/home.html
0 → 100644
View file @
90a9d7a1
<html>
<title>
Django
</title>
</html>
\ No newline at end of file
froyo/templates/task_create_form.html
0 → 100644
View file @
90a9d7a1
<html>
<title>
Task Form
</title>
</html>
\ No newline at end of file
froyo/templates/task_form.html
0 → 100644
View file @
90a9d7a1
<html>
<title>
Task Form
</title>
</html>
\ No newline at end of file
froyo/tests.py
View file @
90a9d7a1
from
django.urls
import
resolve
#froyo/tests
from
django.test
import
TestCase
from
.views
import
home_page
class
HomePage
Test
(
TestCase
):
class
NewTask
Test
(
TestCase
):
def
test_root_url_resolves_to_home_page_view
(
self
):
found
=
resolve
(
'/'
)
self
.
assertEqual
(
found
.
func
,
home_page
)
\ No newline at end of file
def
test_can_get_create_template
(
self
):
response
=
self
.
client
.
get
(
'/tasks/new'
)
self
.
assertTemplateUsed
(
response
,
'task_create_form.html'
)
\ No newline at end of file
froyo/urls.py
View file @
90a9d7a1
#froyo/urls
from
django.conf.urls
import
url
from
.views
import
home_page
from
.views
import
HomeView
,
TaskCreateView
urlpatterns
=
[
url
(
r'^$'
,
home_page
,
name
=
'home_page'
),
url
(
r'^$'
,
HomeView
,
name
=
'home_page'
),
url
(
r'^tasks/new$'
,
TaskCreateView
,
name
=
'task_create'
),
]
\ No newline at end of file
froyo/views.py
View file @
90a9d7a1
from
django.shortcuts
import
render
#froyo/views
from
django.views.generic.base
import
TemplateView
from
django.views.generic.edit
import
CreateView
def
home_page
():
pass
# Create your views here.
class
HomeView
(
TemplateView
):
template_name
=
"home.html"
class
TaskCreateView
(
CreateView
):
template_name_suffix
=
'_create_form'
\ No newline at end of file
functional_test.py
View file @
90a9d7a1
import
unittest
import
time
from
selenium
import
webdriver
from
selenium.webdriver.common.keys
import
Keys
class
NewVisitorTest
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
browser
=
webdriver
.
Firefox
()
def
teardown
(
self
):
self
.
browser
.
quit
()
def
test_can_start_and_retrieve_a_list
(
self
):
self
.
brower
.
get
(
'http://localhost:8000'
)
self
.
assertIn
(
'Django'
,
self
.
browser
.
title
)
self
.
fail
(
'Finish the Test'
)
class
NewVisitorTest
(
unittest
.
TestCase
):
def
test_can_create_new_task
(
self
):
self
.
browser
.
get
(
'http://localhost:8000/tasks'
)
input
=
self
.
browser
.
find_element_by_id
(
'id_new_item'
)
self
.
assertEqual
(
input
.
get_attribute
(
'placeholder'
),
'Enter a to-do item'
)
if
__name__
==
'__main__'
:
unittest
.
main
(
warnings
=
'ignore'
)
\ No newline at end of file
input
.
send_keys
(
'Finish CSCI40 Project'
)
input
.
send_keys
(
Keys
.
Enter
)
time
.
sleep
(
1
)
self
.
assertIn
(
browser
.
getCurrentUrl
(),
'http://localhost:8000/task/1'
)
self
.
assertIn
(
'Finish CSCI40 Project'
,
self
.
browser
.
find_element_by_id
(
'task_name'
)
.
text
)
\ No newline at end of file
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