Fakultas Ilmu Komputer UI

Commit 20a2d989 authored by Misael Jonathan's avatar Misael Jonathan
Browse files

redo migrate

parents 56910225 1bf59ed7
Pipeline #25208 passed with stages
in 10 minutes and 38 seconds
No preview for this file type
......@@ -741,7 +741,7 @@ export default class ProfilePage extends React.Component {
<Icon name="phone" size="big" />
</Grid.Column>
<Grid.Column width={13}>
<p> {this.state.phone_number || 'N/A'}</p>
<p> {this.state.phone_number || 'Nomor Telepon belum ditambahkan'}</p>
</Grid.Column>
</Grid>
</Segment>
......@@ -754,7 +754,7 @@ export default class ProfilePage extends React.Component {
<Grid.Column width={13}>
<a href={this.state.portfolio_link}>
{' '}
{this.state.portfolio_link || 'N/A'}{' '}
{this.state.portfolio_link || 'Portofolio belum ditambahkan'}{' '}
</a>
</Grid.Column>
</Grid>
......@@ -766,7 +766,7 @@ export default class ProfilePage extends React.Component {
<Icon name="venus mars" size="big" />
</Grid.Column>
<Grid.Column width={13}>
<p> {this.state.gender || 'N/A'}</p>
<p> {this.state.gender || 'Gender belum ditambahkan'}</p>
</Grid.Column>
</Grid>
</Segment>
......
......@@ -5,6 +5,40 @@ import fetchMock from 'fetch-mock';
import ProfilePage from '../ProfilePage';
import { studentSession, companyUser, response, response2 } from '../object/Response';
const studentUserVerified = {
role: 'student',
data: {
url: 'http://localhost:8000/api/users/9/',
username: 'muhammad.reza42',
email: 'muhammad.reza42@ui.ac.id',
is_staff: false,
company: null,
supervisor: null,
student: {
id: 3,
user: {
url: 'http://localhost:8000/api/users/9/',
username: 'muhammad.reza42',
email: 'muhammad.reza42@ui.ac.id',
is_staff: false,
},
name: 'Muhammad R.',
created: '2017-03-28T13:33:46.147241Z',
updated: '2017-03-28T13:33:46.148248Z',
npm: 1406543593,
resume: null,
phone_number: null,
bookmarked_vacancies: [
3,
],
applied_vacancies: [
3,
1,
],
},
},
};
describe('ProfilePage', () => {
it('renders without problem', () => {
fetchMock.get('*', response);
......@@ -32,6 +66,21 @@ describe('ProfilePage', () => {
fetchMock.restore();
});
it('get student profile without problem', () => {
fetchMock.get('*', response);
const profile = ReactTestUtils.renderIntoDocument(
<ProfilePage route={{ own: true, data: studentSession }} user={{ data: studentSession }} params={{}} />);
profile.getProfile().then(()=> {
expect(profile.state.name).to.equal(studentUserVerified.data.student.name);
expect(profile.state.npm).to.equal(studentUserVerified.data.student.npm);
expect(profile.state.birth_date).to.equal(studentUserVerified.data.student.birth_date);
expect(profile.state.major).to.equal(studentUserVerified.data.student.major);
expect(profile.state.batch).to.equal(studentUserVerified.data.student.batch);
expect(profile.state.bookmarked_vacancies).to.equal(studentUserVerified.data.student.bookmarked_vacancies);
expect(profile.state.applied_vacancies).to.equal(studentUserVerified.data.student.applied_vacancies);
});
})
it('renders edit profile default value', () => {
fetchMock.get('*', response);
const profile = ReactTestUtils.renderIntoDocument(
......@@ -72,3 +121,4 @@ describe('ProfilePage', () => {
});
});
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-11-15 12:36
# Generated by Django 1.11.17 on 2019-11-15 12:53
from __future__ import unicode_literals
import core.lib.validators
......@@ -89,7 +89,7 @@ class Migration(migrations.Migration):
('latest_work_desc', models.TextField(blank=True, null=True)),
('github_url', models.URLField(blank=True, null=True)),
('intro', models.CharField(blank=True, max_length=50, null=True)),
('expected_salary', models.CharField(blank=True, max_length=10, null=True)),
('expected_salary', models.CharField(blank=True, max_length=10, null=True, validators=[django.core.validators.RegexValidator(b'^\\d{0,10}$')])),
('job_seeking_status', models.CharField(blank=True, max_length=30, null=True)),
('student_gpa', models.FloatField(blank=True, db_column=b'student_gpa', default=1.0, null=True, validators=[core.lib.validators.validate_student_gpa])),
('volunteer', models.CharField(blank=True, max_length=100, null=True)),
......
......@@ -81,7 +81,7 @@ class Student(models.Model):
major = models.CharField(max_length=30, blank=True, null=True)
batch = models.CharField(max_length=4, blank=True, null=True)
show_transcript = models.BooleanField(default=False)
photo = models.FileField(upload_to=get_student_photo_file_path, null=True, blank=True, validators=[FileExtensionValidator(['jpg', 'jpeg', 'png'])])
photo = models.FileField(upload_to=get_student_photo_file_path, null=True, blank=True, validators=[FileExtensionValidator(['jpg', 'jpeg', 'png'])])
self_description = models.CharField(max_length=500, blank=True, db_index=True, null=True)
portfolio_link = models.URLField(blank=True, null=True)
linkedin_url = models.URLField(max_length=200,blank=True, null=True)
......@@ -97,7 +97,7 @@ class Student(models.Model):
latest_work_desc = models.TextField(blank=True, null=True)
github_url = models.URLField(max_length=200,blank=True, null=True)
intro = models.CharField(max_length=50, blank=True, null=True)
expected_salary = models.CharField(max_length=10, blank=True, null=True)
expected_salary = models.CharField(max_length=10, blank=True, null=True, validators=[RegexValidator(r'^\d{0,10}$')])
job_seeking_status = models.CharField(max_length=30, blank=True, null=True)
student_gpa = models.FloatField(db_column='student_gpa', default=1.0, blank=True, null=True, validators=[validate_student_gpa])
volunteer = models.CharField(max_length=100, blank=True, null=True)
......@@ -174,4 +174,4 @@ class Supervisor(models.Model):
return u"Supervisor {}".format(get_display_name(self.user))
class Meta:
ordering = ['-updated']
\ No newline at end of file
ordering = ['-updated']
......@@ -68,6 +68,12 @@ class LoginTests(APITestCase):
response = self.client.post(url, {'username': 'lalala', 'password': 'lalalala', 'login-type' : 'lalala'}, format='json')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
def test_return_age(self):
birth_day = (date.today() -timedelta(days = 700))
self.assertEqual(1, get_current_age(birth_day))
class RegisterTests(APITestCase):
def test_create_and_recreate(self):
url = '/api/register/'
......@@ -210,6 +216,10 @@ class ProfileUpdateTests(APITestCase):
response = self.client.patch(url, {'phone_number': '````'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
url = '/api/students/' + str(student_id) + "/profile/"
response = self.client.patch(url, {'expected_salary': 'abcd'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
url = '/api/students/123123123/profile/'
response = self.client.patch(url, {'phone_number': '08123123123'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
......@@ -268,7 +278,7 @@ class ProfileUpdateTests(APITestCase):
response = self.client.patch(url, {'certification': 'TOEFL'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('certification'), 'TOEFL')
url = '/api/students/' + str(student_id) + "/profile/"
response = self.client.patch(url, {'languages': 'Indonesia, Inggris'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
......@@ -379,7 +389,7 @@ class ProfileUpdateTests(APITestCase):
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'},
response = self.client.post(url, {'username': 'dummy.login.company', 'password': 'lalala123', 'login-type': 'company'},
format='json')
company_id = response.data.get('company').get('id')
......@@ -395,4 +405,4 @@ class ProfileUpdateTests(APITestCase):
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
response = self.client.patch(url, {'website': 'www.huehue.com'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
\ No newline at end of file
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
This diff is collapsed.
......@@ -5602,7 +5602,7 @@
"resolve": {
"version": "1.12.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz",
"integrity": "sha1-P8ZEo1yEpIVUYJ/ybsUrZvpXffY=",
"integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==",
"dev": true,
"requires": {
"path-parse": "^1.0.6"
......@@ -7948,7 +7948,7 @@
"esprima": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
"integrity": "sha1-E7BM2z5sXRnfkatph6hpVhmwqnE=",
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
"dev": true
}
}
......@@ -8650,7 +8650,7 @@
"chalk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
"integrity": "sha1-zUJUFnelQzPPVBpJEIwUMrRMlCQ=",
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
"dev": true,
"requires": {
"ansi-styles": "^3.2.1",
......@@ -10750,9 +10750,15 @@
}
},
"react-router": {
<<<<<<< HEAD
"version": "3.2.4",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-3.2.4.tgz",
"integrity": "sha512-5kIJXV1Yx+FYk0lDJoPQnt+qFf7HxS6XrIm2aCw0r3XQTxixFd0HSVlHenYRWKmSHlcvSQ7bpYWgdRwJGXWPKw==",
=======
"version": "3.2.5",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-3.2.5.tgz",
"integrity": "sha512-0/edMhPfOLRZ5IT3y6UkCpW7a13WrnGMR75ayAh2ZLynujEJOSptJt856GKnoCMW+7rk0/WYGUp/QaZNS9dTKg==",
>>>>>>> 1add5bc7fddddd17020ade4efb6afc2e16f761f9
"requires": {
"create-react-class": "^15.5.1",
"history": "^3.0.0",
......
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment