Fakultas Ilmu Komputer UI
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
PMPL
Class Project
Kape
Commits
28ec0a37
Commit
28ec0a37
authored
Dec 06, 2019
by
KIANUTAMA RADIANUR HUDHA
Browse files
Merge branch 'master' into '1606887516-186'
# Conflicts: # assets/js/CompanyProfile.jsx
parent
6da1cdab
Changes
3
Hide whitespace changes
Inline
Side-by-side
assets/js/CompanyProfile.jsx
View file @
28ec0a37
...
@@ -18,15 +18,15 @@ export default class CompanyProfile extends React.Component {
...
@@ -18,15 +18,15 @@ export default class CompanyProfile extends React.Component {
super
(
props
);
super
(
props
);
this
.
state
=
{
this
.
state
=
{
id
:
this
.
props
.
user
.
data
.
company
.
id
,
id
:
this
.
props
.
user
.
data
.
company
.
id
,
name
:
this
.
props
.
user
.
data
.
company
.
name
,
name
:
''
,
address
:
this
.
props
.
user
.
data
.
company
.
address
,
address
:
''
,
category
:
this
.
props
.
user
.
data
.
company
.
category
,
category
:
''
,
description
:
this
.
props
.
user
.
data
.
company
.
description
,
description
:
''
,
founded
:
this
.
props
.
user
.
data
.
company
.
founded
,
founded
:
''
,
website
:
this
.
props
.
user
.
data
.
company
.
website
,
website
:
''
,
logo
:
this
.
props
.
user
.
data
.
company
.
logo
,
logo
:
''
,
size
:
this
.
props
.
user
.
data
.
company
.
size
,
size
:
''
,
linkedin_url
:
this
.
props
.
user
.
data
.
company
.
linkedin_url
,
linkedin_url
:
''
,
loading
:
false
,
loading
:
false
,
form
:
{
form
:
{
name
:
''
,
name
:
''
,
...
@@ -40,6 +40,8 @@ export default class CompanyProfile extends React.Component {
...
@@ -40,6 +40,8 @@ export default class CompanyProfile extends React.Component {
applications
:
[],
applications
:
[],
vacancies
:
[],
vacancies
:
[],
};
};
this
.
getProfile
();
this
.
getProfile
=
this
.
getProfile
.
bind
(
this
);
this
.
getProfile
=
this
.
getProfile
.
bind
(
this
);
this
.
handleChange
=
this
.
handleChange
.
bind
(
this
);
this
.
handleChange
=
this
.
handleChange
.
bind
(
this
);
this
.
handleSubmit
=
this
.
handleSubmit
.
bind
(
this
);
this
.
handleSubmit
=
this
.
handleSubmit
.
bind
(
this
);
...
...
core/tests/test_accounts.py
View file @
28ec0a37
...
@@ -502,6 +502,33 @@ class ProfileUpdateTests(APITestCase):
...
@@ -502,6 +502,33 @@ class ProfileUpdateTests(APITestCase):
response
=
self
.
client
.
patch
(
url
,
{
'linkedin_url'
:
'this is not valid url'
},
format
=
'multipart'
)
response
=
self
.
client
.
patch
(
url
,
{
'linkedin_url'
:
'this is not valid url'
},
format
=
'multipart'
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_400_BAD_REQUEST
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_400_BAD_REQUEST
)
def
test_company_profile_update_at_once
(
self
):
new_user
=
User
.
objects
.
create_user
(
'dummy.login.company'
,
'dummy.login.company@company.com'
,
'lalala123'
)
Company
.
objects
.
create
(
user
=
new_user
,
description
=
"lalalala"
,
status
=
Company
.
VERIFIED
,
logo
=
None
,
address
=
None
)
url
=
'/api/login/'
response
=
self
.
client
.
post
(
url
,
{
'username'
:
'dummy.login.company'
,
'password'
:
'lalala123'
,
'login-type'
:
'company'
},
format
=
'json'
)
company_id
=
response
.
data
.
get
(
'company'
).
get
(
'id'
)
url
=
'/api/companies/'
+
str
(
company_id
)
+
"/profile/"
response
=
self
.
client
.
patch
(
url
,
{
'name'
:
'Restopedia'
,
'address'
:
'Isekai'
,
'description'
:
'Masak-Masak'
,
'size'
:
'1000'
,
'website'
:
'www.huehue.com'
,
'linkedin_url'
:
'https://www.linkedin.com/company/bob'
},
format
=
'multipart'
)
company
=
Company
.
objects
.
get
(
pk
=
company_id
)
self
.
assertEqual
(
company
.
user
.
first_name
,
'Restopedia'
)
self
.
assertEqual
(
company
.
address
,
'Isekai'
)
self
.
assertEqual
(
company
.
description
,
'Masak-Masak'
)
self
.
assertEqual
(
company
.
size
,
'1000'
)
self
.
assertEqual
(
company
.
website
,
'www.huehue.com'
)
self
.
assertEqual
(
company
.
linkedin_url
,
'https://www.linkedin.com/company/bob'
)
class
ResponseApiLoginCompany
(
APITestCase
):
class
ResponseApiLoginCompany
(
APITestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
username
=
"fesbuk"
self
.
username
=
"fesbuk"
...
@@ -537,9 +564,9 @@ class TranscriptTest(APITestCase):
...
@@ -537,9 +564,9 @@ class TranscriptTest(APITestCase):
format
=
'json'
)
format
=
'json'
)
student_id
=
response
.
data
.
get
(
'student'
).
get
(
'id'
)
student_id
=
response
.
data
.
get
(
'student'
).
get
(
'id'
)
url
=
'/api/students/'
+
str
(
student_id
)
+
"/transcript/"
url
=
'/api/students/'
+
str
(
student_id
)
+
"/transcript/"
response
=
self
.
client
.
get
(
url
)
response
=
self
.
client
.
get
(
url
)
self
.
assertEqual
(
response
.
json
()[
'name'
],
'Dummy Mahasiswa'
)
self
.
assertEqual
(
response
.
json
()[
'name'
],
'Dummy Mahasiswa'
)
self
.
assertEqual
(
response
.
json
()[
'error'
],
'student does not allow transcript to be shown'
)
self
.
assertEqual
(
response
.
json
()[
'error'
],
'student does not allow transcript to be shown'
)
\ No newline at end of file
core/views/accounts/company.py
View file @
28ec0a37
...
@@ -22,6 +22,10 @@ class CompanyViewSet(viewsets.ModelViewSet):
...
@@ -22,6 +22,10 @@ class CompanyViewSet(viewsets.ModelViewSet):
---
---
"""
"""
user
=
self
.
get_object
()
user
=
self
.
get_object
()
if
'name'
in
request
.
data
:
user
.
user
.
first_name
=
request
.
data
[
'name'
]
serializer
=
self
.
serializer_class
(
serializer
=
self
.
serializer_class
(
user
,
data
=
request
.
data
,
partial
=
True
)
user
,
data
=
request
.
data
,
partial
=
True
)
if
serializer
.
is_valid
():
if
serializer
.
is_valid
():
...
...
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