Fakultas Ilmu Komputer UI
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kape
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PMPL
Class Project
Kape
Commits
3618cef0
Commit
3618cef0
authored
8 years ago
by
Joshua Casey
Browse files
Options
Downloads
Patches
Plain Diff
[#140654507] #15 #16 Revised documentation and added testing for register
parent
86332029
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
core/tests/__init__.py
+1
-2
1 addition, 2 deletions
core/tests/__init__.py
core/tests/test_accounts.py
+17
-0
17 additions, 0 deletions
core/tests/test_accounts.py
core/views/accounts.py
+33
-0
33 additions, 0 deletions
core/views/accounts.py
core/views/vacancies.py
+1
-1
1 addition, 1 deletion
core/views/vacancies.py
with
52 additions
and
3 deletions
core/tests/__init__.py
+
1
−
2
View file @
3618cef0
# __init__.py
from
core.tests.test_accounts
import
LoginTests
from
core.tests.test_accounts
import
LoginTests
,
RegisterTests
from
core.tests.test_vacancies
import
ApplicationTests
,
BookmarkApplicationTests
This diff is collapsed.
Click to expand it.
core/tests/test_accounts.py
+
17
−
0
View file @
3618cef0
...
...
@@ -76,3 +76,20 @@ class LoginTests(APITestCase):
url
=
'
/api/login/
'
response
=
self
.
client
.
post
(
url
,
{
'
username
'
:
'
lalala
'
,
'
password
'
:
'
lalalala
'
,
'
login-type
'
:
'
lalala
'
},
format
=
'
json
'
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_400_BAD_REQUEST
)
class
RegisterTests
(
APITestCase
):
def
test_create_and_recreate
(
self
):
url
=
'
/api/register/
'
tc_post
=
{
'
username
'
:
'
dummy.company
'
,
'
password
'
:
'
corporatepass
'
,
'
name
'
:
'
tutuplapak
'
,
'
description
'
:
'
menutup lapak
'
,
'
email
'
:
'
email@email.com
'
}
response
=
self
.
client
.
post
(
url
,
tc_post
,
format
=
'
multipart
'
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_201_CREATED
)
response
=
self
.
client
.
post
(
url
,
tc_post
,
format
=
'
multipart
'
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_409_CONFLICT
)
def
test_bad_request
(
self
):
url
=
'
/api/register/
'
response
=
self
.
client
.
post
(
url
,
{
'
username
'
:
'
lalala
'
},
format
=
'
multipart
'
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_400_BAD_REQUEST
)
This diff is collapsed.
Click to expand it.
core/views/accounts.py
+
33
−
0
View file @
3618cef0
...
...
@@ -139,6 +139,39 @@ class CompanyRegisterViewSet(viewsets.GenericViewSet):
parser_classes
=
(
MultiPartParser
,
FormParser
,)
def
create
(
self
,
request
):
"""
Create a new company user
---
parameters:
- name: username
description: username of the new account
required: true
type: string
- name: password
description: password of the new acoount
required: true
type: string
- name: email
description: email address of the new acoount
required: true
type: string
- name: name
description: the new company
'
s name
required: true
type: string
- name: description
description: description of the new company
required: true
type: string
- name: logo
description: logo of the new company
required: false
type: image
- name: address
description: address of the new acoount
required: false
type: string
"""
username
=
request
.
data
.
get
(
'
username
'
)
password
=
request
.
data
.
get
(
'
password
'
)
email
=
request
.
data
.
get
(
'
email
'
)
...
...
This diff is collapsed.
Click to expand it.
core/views/vacancies.py
+
1
−
1
View file @
3618cef0
...
...
@@ -40,7 +40,7 @@ class ApplicationViewSet(viewsets.GenericViewSet):
---
parameters:
- name: body
description: JSON object containing
only one string: vacancy_id
description: JSON object containing
an integer
'
vacancy_id
'
and a string
'
cover_letter
'
required: true
type: string
paramType: body
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment