Fakultas Ilmu Komputer UI

Commit 778e9df8 authored by Khoirul Khuluqi Abdulloh's avatar Khoirul Khuluqi Abdulloh
Browse files
parents 003cab02 1471acce
Pipeline #26867 passed with stages
in 14 minutes and 40 seconds
...@@ -71,7 +71,20 @@ img { ...@@ -71,7 +71,20 @@ img {
-moz-background-size: cover; -moz-background-size: cover;
-o-background-size: cover; -o-background-size: cover;
background-size: cover; background-size: cover;
padding-bottom: 80px; min-height: 100vh;
display: flex;
flex-flow: column;
}
.register-card {
width: calc(100% - 2rem) !important;
margin: 1rem !important;
padding: 1rem !important;
}
.auth-page-content {
flex-grow: 1;
padding-bottom: 30px;
} }
.headerLoginform { .headerLoginform {
......
import React from 'react';
import PropTypes from 'prop-types';
import CompanyRegisterModal from './components/CompanyRegisterModal';
import Footer from './components/Footer';
import {
Grid, Header, Image
} from 'semantic-ui-react';
const CompanyRegisterPage = () => {
return (
<div class="halamanLogin">
<div class="auth-page-content">
<div class="headerLogin">
<Header as="h2" icon textAlign="center">
<Image src="/assets/img/logo.png" size="medium" centered />
<Header.Content>Kanal Akses Pendaftaran KP Elektronik</Header.Content>
</Header>
</div>
<Grid
stackable
columns={2}
padded
style={{ display: 'flex', justifyContent: 'center' }}
>
<Grid.Column width="seven" style={{
backgroundColor: 'white', border: '1px solid #aeaeae',
borderRadius: '6px'
}}>
<CompanyRegisterModal />
</Grid.Column>
</Grid>
</div>
<Footer />
</div>
);
};
CompanyRegisterPage.propTypes = {
children: PropTypes.node,
};
CompanyRegisterPage.defaultProps = {
children: null,
};
export default CompanyRegisterPage;
...@@ -4,7 +4,6 @@ import { ...@@ -4,7 +4,6 @@ import {
Grid, Segment, Header, Card, Image, Button, Grid, Segment, Header, Card, Image, Button,
} from 'semantic-ui-react'; } from 'semantic-ui-react';
import LoginForm from './components/LoginForm'; import LoginForm from './components/LoginForm';
import CompanyRegisterModal from './components/CompanyRegisterModal';
import Footer from './components/Footer'; import Footer from './components/Footer';
import InfoModal from './components/InfoModal'; import InfoModal from './components/InfoModal';
...@@ -66,6 +65,7 @@ const Login = ({ children }) => { ...@@ -66,6 +65,7 @@ const Login = ({ children }) => {
return ( return (
<div className="halamanLogin"> <div className="halamanLogin">
<div className="auth-page-content">
<div className="headerLogin"> <div className="headerLogin">
<Header as="h2" icon textAlign="center"> <Header as="h2" icon textAlign="center">
<Image src="/assets/img/logo.png" size="medium" centered /> <Image src="/assets/img/logo.png" size="medium" centered />
...@@ -90,22 +90,21 @@ const Login = ({ children }) => { ...@@ -90,22 +90,21 @@ const Login = ({ children }) => {
{children} {children}
</CompanyForm> </CompanyForm>
)} )}
<div className="register"> {activeForm !== 'user' ? (
<Card centered className="register"> <Card className="register register-card">
<Card.Content>
<Grid columns={2} relaxed> <Grid columns={2} relaxed>
<Grid.Column> <Grid.Column>
<Header as="h3">New to us ?</Header> <Header as="h3">New to us ?</Header>
</Grid.Column> </Grid.Column>
<Grid.Column> <Grid.Column>
<CompanyRegisterModal /> <a className="ui primary button" href="/register-perusahaan">Register Your Company</a>
</Grid.Column> </Grid.Column>
</Grid> </Grid>
</Card.Content>
</Card> </Card>
</div> ) : ""}
</Grid.Column> </Grid.Column>
</Grid> </Grid>
</div>
<Footer /> <Footer />
</div> </div>
); );
......
import React from 'react';
import CompanyRegisterPage from '../CompanyRegisterPage';
import CompanyRegisterModal from '../components/CompanyRegisterModal';
import { shallow } from 'enzyme';
describe('CompanyRegisterPage', () => {
it('renders main form component ', () => {
const wrapper = shallow(<CompanyRegisterPage />);
expect(wrapper.find(CompanyRegisterModal)).to.exist;
});
});
\ No newline at end of file
...@@ -129,7 +129,7 @@ export default class CompanyRegisterModal extends React.Component { ...@@ -129,7 +129,7 @@ export default class CompanyRegisterModal extends React.Component {
benefitViews.push(benefitView); benefitViews.push(benefitView);
}); });
return ( return (
<Modal trigger={<Button primary floated="right">Register</Button>} closeIcon="close"> <div>
<Header icon="archive" content="Register for More Benefits" /> <Header icon="archive" content="Register for More Benefits" />
<ul>{benefitViews}</ul> <ul>{benefitViews}</ul>
<Modal.Content> <Modal.Content>
...@@ -238,7 +238,7 @@ Submit ...@@ -238,7 +238,7 @@ Submit
</Form> </Form>
</Modal.Content> </Modal.Content>
</Modal> </div>
); );
} }
} }
...@@ -12,6 +12,7 @@ import CreateVacancy from './CreateVacancy'; ...@@ -12,6 +12,7 @@ import CreateVacancy from './CreateVacancy';
import Server from './lib/Server'; import Server from './lib/Server';
import Storage from './lib/Storage'; import Storage from './lib/Storage';
import ApplicantPage from './ApplicantPage'; import ApplicantPage from './ApplicantPage';
import CompanyRegisterPage from './CompanyRegisterPage';
import TranscriptPage from './TranscriptPage'; import TranscriptPage from './TranscriptPage';
import AdminVacancyPage from './AdminVacancyPage'; import AdminVacancyPage from './AdminVacancyPage';
import CompanyPage from './CompanyPage'; import CompanyPage from './CompanyPage';
...@@ -82,7 +83,8 @@ export default class App extends React.Component { ...@@ -82,7 +83,8 @@ export default class App extends React.Component {
}; };
handleAuth = (nextState, replace) => { handleAuth = (nextState, replace) => {
if (!Server.isLoggedIn()) replace({ pathname: '/login' }); const EXCLUDED_PATHS = ['register-perusahaan', 'login']
if (!Server.isLoggedIn() && EXCLUDED_PATHS.indexOf(nextState.pathname) < 0) replace({ pathname: '/login' });
Storage.getUserData(); Storage.getUserData();
}; };
...@@ -126,6 +128,7 @@ export default class App extends React.Component { ...@@ -126,6 +128,7 @@ export default class App extends React.Component {
return ( return (
<Router history={browserHistory}> <Router history={browserHistory}>
<Route path="/login" component={Login} /> <Route path="/login" component={Login} />
<Route path="/register-perusahaan" component={CompanyRegisterPage} />
<Route component={all(Dashboard)} onEnter={this.handleAuth}> <Route component={all(Dashboard)} onEnter={this.handleAuth}>
<Route path="/transkrip/:id" component={commonUser(TranscriptPage)} /> <Route path="/transkrip/:id" component={commonUser(TranscriptPage)} />
<Route path="/lowongan" component={all(VacancyPage)} /> <Route path="/lowongan" component={all(VacancyPage)} />
......
from django.test import TestCase
from django.contrib.auth.models import User
from core.models.accounts import Company, Student, Supervisor
from core.serializers.accounts import StudentSerializer, StudentUpdateSerializer, CompanyUpdateSerializer
import datetime
class TestAccountSerializers(TestCase):
def test_accepted_no(self):
user = User.objects.create_user('dummy.login.student', 'dummy.login.student@student.com', 'lalala123')
student = Student.objects.create(user=user, npm=1606837631, resume=None, sertifikat=None, phone_number="081291693790", gender="laki-laki", birth_place="Jakarta", birth_date=datetime.datetime.now())
self.assertEqual(StudentSerializer.get_accepted_no(student), 0)
def test_read_no(self):
user = User.objects.create_user('dummy.login.student', 'dummy.login.student@student.com', 'lalala123')
student = Student.objects.create(user=user, npm=1606837631, resume=None, sertifikat=None, phone_number="081291693790", gender="laki-laki", birth_place="Jakarta", birth_date=datetime.datetime.now())
self.assertEqual(StudentSerializer.get_read_no(student), 0)
def test_student_update_serializers(self):
user = User.objects.create_user('dummy.login.student', 'dummy.login.student@student.com', 'lalala123')
student = Student.objects.create(user=user, npm=1606837631, resume=None, sertifikat=None, phone_number="081291693790", gender="laki-laki", birth_place="Jakarta", birth_date=datetime.datetime.now())
self.assertEqual(StudentUpdateSerializer.to_representation(self, student),
{
'resume': None,
'email': student.user.email,
'phone_number': student.phone_number,
'gender': student.gender,
'region': student.region,
'photo': None,
'show_transcript': student.show_transcript,
'portfolio_link': student.portfolio_link,
'self_description': student.self_description,
'intro': student.intro,
'expected_salary': student.expected_salary,
'job_seeking_status': student.job_seeking_status,
'website_url': student.website_url,
'student_gpa': student.student_gpa,
'student_toefl':student.student_toefl,
'student_toefl_file': None,
'volunteer': student.volunteer,
'linkedin_url': student.linkedin_url,
'hackerrank_url': student.hackerrank_url,
'work_experience': student.work_experience,
'latest_work': student.latest_work,
'latest_work_desc': student.latest_work_desc,
'alamat': student.alamat,
'skills': student.skills,
'github_url': student.github_url,
'gitlab_url': student.gitlab_url,
'awards': student.awards,
'projects': student.projects,
'certification': student.certification,
'languages': student.languages,
'seminar': student.seminar,
'interests': student.interests,
'dependants': student.dependants,
'related_course':student.related_course,
'ielts':student.ielts,
})
def test_company_update_serializers(self):
user = User.objects.create_user('dummy.login.company', 'dummy.login.company@company.com', 'lalala123')
company = Company.objects.create(user=user, description="lalalala", status=Company.VERIFIED, logo=None, address=None, category="perusahaan listrik", size="20", website="www.www", linkedin_url=None)
self.assertEqual(CompanyUpdateSerializer.to_representation(self, company),
{
'address': company.address,
'description': company.description,
'founded': company.founded,
'name': company.user.first_name,
'website': company.website,
'linkedin_url': company.linkedin_url,
'size': company.size,
})
...@@ -167,6 +167,28 @@ class ApplicationTests(APITestCase): ...@@ -167,6 +167,28 @@ class ApplicationTests(APITestCase):
format='json') format='json')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
def test_get_applicant_transcript_denied(self):
company_user = User.objects.create_user('dummy.company', 'dummy.company@company.com', 'lalala123')
student_user = User.objects.create_user('dummy.student', 'dummy.student@student.com', 'lalala123')
self.client.force_authenticate(student_user)
self.client.force_authenticate(company_user)
new_student = Student.objects.create(user=student_user, npm=1234123412)
new_company = Company.objects.create(user=company_user, description="lalala", status=Company.VERIFIED, logo=None,
address=None)
new_vacancy = Vacancy.objects.create(company=new_company, verified=True, open_time=datetime.fromtimestamp(0),
description="lalala", close_time=datetime.today(),
max_accepted_applicants=3, working_period="3 Bulan")
new_application = Application.objects.create(student=new_student, vacancy=new_vacancy, cover_letter="lorem ipsum")
url = '/api/applications/' + str(new_application.pk) + '/transcript/'
response = self.client.get(url, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.json()['error'], 'student does not allow transcript to be shown')
class BookmarkApplicationTests(APITestCase): class BookmarkApplicationTests(APITestCase):
@requests_mock.Mocker() @requests_mock.Mocker()
...@@ -496,6 +518,30 @@ class VacancyTest(APITestCase): ...@@ -496,6 +518,30 @@ class VacancyTest(APITestCase):
self.assertRaisesMessage(status.HTTP_400_BAD_REQUEST, self.assertRaisesMessage(status.HTTP_400_BAD_REQUEST,
date_validator(str(datetime.today()), str(datetime.today()))['status']) date_validator(str(datetime.today()), str(datetime.today()))['status'])
def test_count_vacancy(self):
company_user = User.objects.create_user('dummy.company', 'dummy.company@company.com', 'lalala123')
student_user = User.objects.create_user('dummy.student', 'dummy.student@student.com', 'lalala123')
self.client.force_authenticate(company_user)
new_company = Company.objects.create(user=company_user, description="lalala", status=Company.VERIFIED, logo=None,
address=None)
new_student = Student.objects.create(user=student_user, npm=1234123412)
new_vacancy = Vacancy.objects.create(company=new_company, verified=True, open_time=datetime.fromtimestamp(0),
description="lalala", close_time=datetime.today(),
max_accepted_applicants=3, working_period="3 Bulan")
Application.objects.create(student=new_student, vacancy=new_vacancy, cover_letter="lorem ipsum")
url = '/api/vacancies/' + str(new_vacancy.pk) + '/count/'
response = self.client.get(url, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.json()['count'], 1)
self.assertEqual(response.json()['count_new'], 1)
class CompanyListsTests(APITestCase): class CompanyListsTests(APITestCase):
def test_company_vacancy_list(self): def test_company_vacancy_list(self):
......
Supports Markdown
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