-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'frontend_testen' of https://github.com/SELab-2/UGent-4 …
…into frontend_testen
- Loading branch information
Showing
25 changed files
with
635 additions
and
585 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
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,7 +1,9 @@ | ||
from django.contrib.auth.models import User | ||
from api.models.gebruiker import Gebruiker | ||
from api.serializers.gebruiker import GebruikerSerializer | ||
|
||
from api.serializers.template import TemplateSerializer | ||
from django.core.files import File | ||
import os | ||
|
||
|
||
class AuthenticationUserMiddleware: | ||
|
@@ -22,7 +24,7 @@ def __init__(self, get_response): | |
self.get_response = get_response | ||
|
||
def __call__(self, request): | ||
|
||
mail = "[email protected]" | ||
try: | ||
user = User.objects.get(username=mail) | ||
|
@@ -39,6 +41,16 @@ def __call__(self, request): | |
try: | ||
Gebruiker.objects.get(pk=request.user.id) | ||
except Gebruiker.DoesNotExist: | ||
directory_path = "api/base_templates" | ||
for filename in os.listdir(directory_path): | ||
file_path = os.path.join(directory_path, filename) | ||
with open(file_path, "rb") as f: | ||
django_file = File(f) | ||
template_data = {"user": request.user.id, "bestand": django_file} | ||
serializer = TemplateSerializer(data=template_data) | ||
if serializer.is_valid(): | ||
serializer.save() | ||
|
||
gebruiker_post_data = { | ||
"user": request.user.id, | ||
"subjects": [], | ||
|
@@ -52,7 +64,6 @@ def __call__(self, request): | |
|
||
|
||
class DisableCSRFMiddleware(object): | ||
|
||
def __init__(self, get_response): | ||
self.get_response = get_response | ||
|
||
|
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,7 +1,9 @@ | ||
from django.contrib.auth.models import User | ||
from api.models.gebruiker import Gebruiker | ||
from api.serializers.gebruiker import GebruikerSerializer | ||
|
||
from api.serializers.template import TemplateSerializer | ||
from django.core.files import File | ||
import os | ||
|
||
|
||
class AuthenticationUserMiddleware: | ||
|
@@ -22,7 +24,7 @@ def __init__(self, get_response): | |
self.get_response = get_response | ||
|
||
def __call__(self, request): | ||
|
||
mail = "[email protected]" | ||
try: | ||
user = User.objects.get(username=mail) | ||
|
@@ -39,6 +41,16 @@ def __call__(self, request): | |
try: | ||
Gebruiker.objects.get(pk=request.user.id) | ||
except Gebruiker.DoesNotExist: | ||
directory_path = "api/base_templates" | ||
for filename in os.listdir(directory_path): | ||
file_path = os.path.join(directory_path, filename) | ||
with open(file_path, "rb") as f: | ||
django_file = File(f) | ||
template_data = {"user": request.user.id, "bestand": django_file} | ||
serializer = TemplateSerializer(data=template_data) | ||
if serializer.is_valid(): | ||
serializer.save() | ||
|
||
gebruiker_post_data = { | ||
"user": request.user.id, | ||
"subjects": [], | ||
|
@@ -52,7 +64,6 @@ def __call__(self, request): | |
|
||
|
||
class DisableCSRFMiddleware(object): | ||
|
||
def __init__(self, get_response): | ||
self.get_response = get_response | ||
|
||
|
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
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 was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
|
@@ -8,28 +8,26 @@ describe('create and change a course', () => { | |
cy.get('#addCourse').click() | ||
// fill in the fields | ||
cy.get('#courseName').type('test course') | ||
cy.get('#uploadStudent').get('#email').type('[email protected]') | ||
cy.get('#uploadStudent').get('#add').click() | ||
cy.get('#save').click() | ||
cy.get('#confirm').click() | ||
// check if course was added | ||
cy.get('#logo').click(); | ||
cy.contains('test course').should('exist') | ||
cy.contains('Students: 1').should('exist') | ||
cy.contains('Students: 0').should('exist') | ||
}) | ||
|
||
it('alter course', () => { | ||
|
||
cy.contains('test course').click() | ||
cy.get('#editButton').click() | ||
// add a student | ||
cy.get('#uploadStudent').get('#email').type('student1@testing.com') // make sure there is a student 1 in the db | ||
cy.get('#uploadStudent').get('#email').type('student@testing.com') | ||
cy.get('#uploadStudent').get('#add').click() | ||
// save course | ||
cy.get('#save').click() | ||
cy.get('#confirm').click() | ||
// check if the student was added | ||
cy.get('#logo').click(); | ||
cy.contains('Students: 2').should('exist') | ||
cy.contains('Students: 1').should('exist') | ||
}) | ||
}) |
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
Binary file not shown.
Oops, something went wrong.