-
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.
Merge branch 'master' into 789-common-header
- Loading branch information
Showing
9 changed files
with
121 additions
and
60 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 |
---|---|---|
@@ -1,9 +1,7 @@ | ||
name: Deploy to Server | ||
|
||
on: | ||
pull_request: | ||
# Change to merge when implemented (still beta) | ||
types: [closed] | ||
push: | ||
branches: | ||
- master | ||
|
||
|
@@ -12,22 +10,21 @@ jobs: | |
name: Deploy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: executing remote ssh commands using key | ||
uses: appleboy/[email protected] | ||
if: github.event.pull_request.merged == true | ||
with: | ||
host: ${{ secrets.host }} | ||
username: ${{ secrets.user }} | ||
key: ${{ secrets.id }} | ||
port: ${{ secrets.port }} | ||
script: | | ||
cd ${{ secrets.deploy_dir }} | ||
. venv-prod/bin/activate | ||
cd website | ||
git pull | ||
python -m pip install --upgrade pip | ||
pip install --upgrade --force-reinstall -r prod_requirements.txt | ||
python manage.py migrate | ||
python manage.py collectstatic --noinput | ||
python manage.py compilemessages | ||
echo "${{ secrets.dingseboms_password }}" | sudo -S systemctl restart gunicorn | ||
- name: executing remote ssh commands using key | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.host }} | ||
username: ${{ secrets.user }} | ||
key: ${{ secrets.id }} | ||
port: ${{ secrets.port }} | ||
script: | | ||
cd ${{ secrets.deploy_dir }} | ||
. venv-prod/bin/activate | ||
cd website | ||
git pull | ||
python -m pip install --upgrade pip | ||
pip install --upgrade --force-reinstall -r prod_requirements.txt | ||
python manage.py migrate | ||
python manage.py collectstatic --noinput | ||
python manage.py compilemessages | ||
echo "${{ secrets.dingseboms_password }}" | sudo -S systemctl restart gunicorn |
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 |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
from social_django.utils import load_backend, load_strategy | ||
|
||
from authentication.apps import AuthenticationConfig | ||
from authentication.views import associate_by_email, save_profile | ||
from authentication.views import associate_by_email, convert_to_stud_email, save_profile | ||
|
||
|
||
class AuthenticationConfigTest(TestCase): | ||
|
@@ -126,3 +126,48 @@ def test_existing_user_profiles(self): | |
def test_assoc_existing_user(self): | ||
associate = associate_by_email(self.backend, {}, user=self.testuser) | ||
self.assertIsNone(associate) | ||
|
||
def test_convert_stud_emails(self): | ||
emails = [ | ||
"[email protected]", | ||
"[email protected]", | ||
] | ||
new_emails = convert_to_stud_email(*emails) | ||
|
||
self.assertEqual(emails, new_emails) | ||
|
||
def test_convert_ntnu_emails(self): | ||
emails = [ | ||
"[email protected]", | ||
"[email protected]", | ||
] | ||
|
||
new_emails = convert_to_stud_email(*emails) | ||
|
||
self.assertEqual(len(new_emails), 2) | ||
self.assertNotEqual(emails, new_emails) | ||
self.assertEqual(new_emails[0], "[email protected]") | ||
self.assertEqual(new_emails[1], "[email protected]") | ||
|
||
def test_convert_ntnu_and_stud_emails(self): | ||
emails = [ | ||
"[email protected]", | ||
"[email protected]", | ||
] | ||
|
||
new_emails = convert_to_stud_email(*emails) | ||
|
||
self.assertEqual(len(new_emails), 2) | ||
self.assertNotEqual(emails, new_emails) | ||
self.assertEqual(new_emails[0], "[email protected]") | ||
self.assertEqual(new_emails[0], emails[0]) | ||
self.assertEqual(new_emails[1], "[email protected]") | ||
|
||
def test_convert_empty_email(self): | ||
emails = ["", "ntnu", "@ntnu.", "@ntnu.no"] | ||
new_emails = convert_to_stud_email(*emails) | ||
self.assertEqual(new_emails, ["ntnu", "@stud.ntnu.no", "@stud.ntnu.no"]) | ||
|
||
def test_convert_none_values(self): | ||
new_emails = convert_to_stud_email("[email protected]", None, None) | ||
self.assertEqual(new_emails, ["[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
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 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