-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
50 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from django.test import TestCase | ||
from academy.apps.offices.models import Setting, AuthSetting, ConfigEmail | ||
|
||
|
||
class AcademyTestCase(TestCase): | ||
|
||
def setUp(self): | ||
Setting.objects.create() | ||
AuthSetting.objects.create() | ||
ConfigEmail.objects.update_or_create( | ||
id=1, | ||
from_email="[email protected]", | ||
email_host="mail.example.id", | ||
email_user="[email protected]", | ||
email_password="Password123", | ||
email_port=587, | ||
use_tls=False, | ||
recipient_email="[email protected]" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,19 @@ | ||
from django.test import TestCase | ||
from django.test import Client | ||
from tests import AcademyTestCase | ||
|
||
from academy.apps.accounts.models import User, Inbox | ||
from academy.apps.offices.models import Setting, AuthSetting | ||
|
||
|
||
class AccountsUserViewTest(TestCase): | ||
class AccountsUserViewTest(AcademyTestCase): | ||
fixtures = ['accounts.json', 'students.json'] | ||
|
||
def setUp(self): | ||
Setting.objects.create() | ||
AuthSetting.objects.create() | ||
super().setUp() | ||
self.user = User.objects.get(email='[email protected]') | ||
self.user.set_password('password123') | ||
self.user.save() | ||
|
||
def test_inbox(self): | ||
user = User.objects.get(email='[email protected]') | ||
user.set_password('password123') | ||
user.save() | ||
|
||
login = self.client.login(username=user.username, password='password123') | ||
login = self.client.login(username=self.user.username, password='password123') | ||
self.assertTrue(login) | ||
|
||
# normal url | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from django.test import TestCase | ||
from tests import AcademyTestCase | ||
from django.urls import reverse | ||
|
||
from academy.apps.accounts.models import User | ||
|
@@ -7,19 +7,19 @@ | |
from academy.website.accounts.forms import SurveyForm | ||
|
||
|
||
class AuthUserViewTest(TestCase): | ||
class AuthUserViewTest(AcademyTestCase): | ||
fixtures = ['accounts.json', 'students.json'] | ||
|
||
def test_auth_user(self): | ||
user = User.objects.get(email='[email protected]') | ||
url = user.generate_auth_url() | ||
response = self.client.get(url) | ||
|
||
# kalau belum punya survey harus redirect ke survey | ||
self.assertRedirects(response, '/accounts/survey/', status_code=302, target_status_code=200, fetch_redirect_response=True) | ||
|
||
#test untuk user yang sudah memiliki memiliki survey | ||
#create survey | ||
# test untuk user yang sudah memiliki memiliki survey | ||
# create survey | ||
data = { | ||
'working_status': Survey.WORKING_STATUS_CHOICES.employee, | ||
'graduate_channeled': True, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters