Merge branch 'master' into feature/replace-react-to-vue-add-login-panel
This commit is contained in:
commit
2389eb28ae
2 changed files with 157 additions and 18 deletions
47
README.md
47
README.md
|
@ -1,38 +1,51 @@
|
|||
# Wulkanowy-web
|
||||
🌋 Unofficial browser VULCAN UONET+ client for both students and their parents
|
||||
# Wulkanowy Web
|
||||
|
||||
🌋 Unofficial VULCAN UONET+ browser client for students and their parents
|
||||
|
||||
![GitHub Workflow Status](https://github.com/wulkanowy/wulkanowy-web/workflows/Python%20application/badge.svg)
|
||||
[![Discord](https://img.shields.io/discord/390889354199040011.svg?color=#33CD56)](https://discord.gg/vccAQBr)
|
||||
|
||||
## Join our Discord server!
|
||||
|
||||
[![Discord](https://discordapp.com/api/guilds/390889354199040011/widget.png?style=banner2)](https://discord.com/invite/vccAQBr)
|
||||
|
||||
# Development
|
||||
## 1. Install dependencies.
|
||||
```shell
|
||||
|
||||
## 1. Install dependencies
|
||||
|
||||
```sh
|
||||
pip install -r requirements.txt
|
||||
npm i
|
||||
```
|
||||
And in frontend:
|
||||
```shell
|
||||
npm install
|
||||
```
|
||||
|
||||
## 2. Make migrations
|
||||
```shell
|
||||
|
||||
```sh
|
||||
python manage.py makemigrations
|
||||
python manage.py migrate
|
||||
```
|
||||
## 3. Start the server!
|
||||
```shell
|
||||
|
||||
## 3. Start the server
|
||||
|
||||
```sh
|
||||
python manage.py runserver
|
||||
```
|
||||
And in frontend:
|
||||
```shell
|
||||
cd frontend
|
||||
npm run build
|
||||
```
|
||||
|
||||
# Docker
|
||||
## With docker compose
|
||||
```shell
|
||||
|
||||
With docker compose
|
||||
|
||||
```sh
|
||||
docker-compose up -d
|
||||
```
|
||||
## Without docker compose
|
||||
```shell
|
||||
|
||||
Without docker compose
|
||||
|
||||
```sh
|
||||
docker build -t wulkanowy/web .
|
||||
docker run -d -p 8000:8000 wulkanowy/web
|
||||
docker run -d -p 8000:8000 wulkanowy/web
|
||||
```
|
||||
|
|
|
@ -11,20 +11,35 @@ class TestViews(TestCase):
|
|||
|
||||
def test_views(self):
|
||||
#DEFAULT_VIEW
|
||||
print("\033[94mTesting login view...")
|
||||
response = self.client.get(self.list_url)
|
||||
|
||||
self.assertEquals(response.status_code, 200)
|
||||
self.assertTemplateUsed(response, 'frontend/index.html')
|
||||
if response.status_code == 200:
|
||||
print("\033[92mPassed!")
|
||||
else:
|
||||
print("\033[91mFailed!")
|
||||
|
||||
#CONTENT_VIEW
|
||||
print("\033[94mTesting content view...")
|
||||
response = self.client.get(self.detail_url)
|
||||
|
||||
self.assertEquals(response.status_code, 302)
|
||||
if response.status_code == 302:
|
||||
print("\033[92mPassed!")
|
||||
else:
|
||||
print("\033[91mFailed!")
|
||||
|
||||
#ACCOUNT_MANAGER
|
||||
print("\033[94mTesting account manager view...")
|
||||
response = self.client.get(reverse('account_manager'))
|
||||
|
||||
self.assertEquals(response.status_code, 302)
|
||||
if response.status_code == 302:
|
||||
print("\033[92mPassed!")
|
||||
else:
|
||||
print("\033[91mFailed!")
|
||||
|
||||
#API
|
||||
data = {
|
||||
|
@ -33,18 +48,29 @@ class TestViews(TestCase):
|
|||
"Symbol": "powiatwulkanowy",
|
||||
"diaryUrl": "http://cufs.fakelog.cf/"
|
||||
}
|
||||
|
||||
print("\033[94mTesting login...")
|
||||
|
||||
response = self.client.post(reverse('login'), content_type='application/xml', data=json.dumps(data))
|
||||
cookies_data = response.json()
|
||||
|
||||
self.assertEquals(response.status_code, 200)
|
||||
if response.status_code == 200:
|
||||
print("\033[92mPassed!")
|
||||
else:
|
||||
print("\033[91mFailed!")
|
||||
|
||||
students = cookies_data['data']['students']['data']
|
||||
#JAN
|
||||
print("\033[94mTesting as Jan Kowalski...")
|
||||
print("\033[95m============================================================")
|
||||
jan_data = students[0]
|
||||
cookies_data['data']['students']['data'] = [jan_data]
|
||||
get_data_test(self.client, cookies_data, self.assertEquals)
|
||||
print("\033[96m========================================================================")
|
||||
#JOANNA
|
||||
print("\033[94mTesting as Joanna Czerwińska...")
|
||||
print("\033[95m============================================================")
|
||||
joanna_data = students[3]
|
||||
cookies_data['data']['students']['data'] = [joanna_data]
|
||||
get_data_test(self.client, cookies_data, self.assertEquals)
|
||||
|
@ -53,83 +79,169 @@ class TestViews(TestCase):
|
|||
|
||||
def get_data_test(client, cookies_data, assertEquals):
|
||||
#GRADES
|
||||
print("\033[94mTesting grades...")
|
||||
response = client.post(reverse('grades'), content_type='application/xml', data=json.dumps(cookies_data))
|
||||
assertEquals(response.status_code, 200)
|
||||
if response.status_code == 200:
|
||||
print("\033[92mPassed!")
|
||||
else:
|
||||
print("\033[91mFailed!")
|
||||
|
||||
#TIMETABLE
|
||||
print("\033[94mTesting timetable...")
|
||||
response = client.post(reverse('timetable'), content_type='application/xml', data=json.dumps({'cookies': json.dumps(cookies_data), 'week': 0}))
|
||||
assertEquals(response.status_code, 200)
|
||||
if response.status_code == 200:
|
||||
print("\033[92mPassed!")
|
||||
else:
|
||||
print("\033[91mFailed!")
|
||||
|
||||
#EXAMS
|
||||
print("\033[94mTesting exams...")
|
||||
response = client.post(reverse('exams'), content_type='application/xml', data=json.dumps({'cookies': json.dumps(cookies_data), 'week': 0}))
|
||||
assertEquals(response.status_code, 200)
|
||||
if response.status_code == 200:
|
||||
print("\033[92mPassed!")
|
||||
else:
|
||||
print("\033[91mFailed!")
|
||||
|
||||
#HOMEWORKS
|
||||
print("\033[94mTesting homeworks...")
|
||||
response = client.post(reverse('homeworks'), content_type='application/xml', data=json.dumps({'cookies': json.dumps(cookies_data), 'week': 0}))
|
||||
assertEquals(response.status_code, 200)
|
||||
if response.status_code == 200:
|
||||
print("\033[92mPassed!")
|
||||
else:
|
||||
print("\033[91mFailed!")
|
||||
|
||||
#ATTENDANCE
|
||||
print("\033[94mTesting attendance...")
|
||||
response = client.post(reverse('attendance'), content_type='application/xml', data=json.dumps({'cookies': json.dumps(cookies_data), 'week': 0}))
|
||||
assertEquals(response.status_code, 200)
|
||||
if response.status_code == 200:
|
||||
print("\033[92mPassed!")
|
||||
else:
|
||||
print("\033[91mFailed!")
|
||||
|
||||
#NOTES
|
||||
print("\033[94mTesting notes...")
|
||||
response = client.post(reverse('notes'), content_type='application/xml', data=json.dumps(cookies_data))
|
||||
assertEquals(response.status_code, 200)
|
||||
if response.status_code == 200:
|
||||
print("\033[92mPassed!")
|
||||
else:
|
||||
print("\033[91mFailed!")
|
||||
|
||||
#SCHOOL DATA
|
||||
print("\033[94mTesting school data...")
|
||||
response = client.post(reverse('school_data'), content_type='application/xml', data=json.dumps(cookies_data))
|
||||
assertEquals(response.status_code, 200)
|
||||
if response.status_code == 200:
|
||||
print("\033[92mPassed!")
|
||||
else:
|
||||
print("\033[91mFailed!")
|
||||
|
||||
#DASHBOARD
|
||||
print("\033[94mTesting dashboard...")
|
||||
response = client.post(reverse('dashboard'), content_type='application/xml', data=json.dumps(cookies_data))
|
||||
assertEquals(response.status_code, 200)
|
||||
if response.status_code == 200:
|
||||
print("\033[92mPassed!")
|
||||
else:
|
||||
print("\033[91mFailed!")
|
||||
|
||||
#MOBILE ACCESS
|
||||
#REGISTERED DEVICES
|
||||
print("\033[94mTesting registered devices...")
|
||||
response = client.post(reverse('registered_devices'), content_type='application/xml', data=json.dumps(cookies_data))
|
||||
assertEquals(response.status_code, 200)
|
||||
if response.status_code == 200:
|
||||
print("\033[92mPassed!")
|
||||
else:
|
||||
print("\033[91mFailed!")
|
||||
|
||||
#REGISTER DEVICE
|
||||
print("\033[94mTesting registering device...")
|
||||
response = client.post(reverse('register_device'), content_type='application/xml', data=json.dumps(cookies_data))
|
||||
assertEquals(response.status_code, 200)
|
||||
if response.status_code == 200:
|
||||
print("\033[92mPassed!")
|
||||
else:
|
||||
print("\033[91mFailed!")
|
||||
|
||||
#MESSAGES
|
||||
#RECEIVED MESSAGES
|
||||
print("\033[94mTesting received messages...")
|
||||
messages_ids = []
|
||||
response = client.post(reverse('received_messages'), content_type='application/xml', data=json.dumps(cookies_data))
|
||||
assertEquals(response.status_code, 200)
|
||||
messages_ids.append([response.json()['data']])
|
||||
if response.status_code == 200:
|
||||
print("\033[92mPassed!")
|
||||
else:
|
||||
print("\033[91mFailed!")
|
||||
|
||||
#SENT MESSAGES
|
||||
print("\033[94mTesting sent messages...")
|
||||
response = client.post(reverse('sent_messages'), content_type='appication/xml', data=json.dumps(cookies_data))
|
||||
assertEquals(response.status_code, 200)
|
||||
for id in response.json()['data']:
|
||||
messages_ids.append(id)
|
||||
if response.status_code == 200:
|
||||
print("\033[92mPassed!")
|
||||
else:
|
||||
print("\033[91mFailed!")
|
||||
|
||||
#DELETED MESSAGES
|
||||
print("\033[94mTesting deleted messages...")
|
||||
response = client.post(reverse('deleted_messages'), content_type='application/xml', data=json.dumps(cookies_data))
|
||||
assertEquals(response.status_code, 200)
|
||||
messages_ids.append([response.json()['data']])
|
||||
if response.status_code == 200:
|
||||
print("\033[92mPassed!")
|
||||
else:
|
||||
print("\033[91mFailed!")
|
||||
|
||||
#GET RECIPIENTS
|
||||
print("\033[94mTesting getting recipients...")
|
||||
response = client.post(reverse('recipients'), content_type='application/xml', data=json.dumps(cookies_data))
|
||||
assertEquals(response.status_code, 200)
|
||||
recipients = response.json()['addressee']['data']
|
||||
if response.status_code == 200:
|
||||
print("\033[92mPassed!")
|
||||
else:
|
||||
print("\033[91mFailed!")
|
||||
|
||||
#STUDENT DATA
|
||||
print("\033[94mTesting student data...")
|
||||
response = client.post(reverse('student_data'), content_type='application/xml', data=json.dumps(cookies_data))
|
||||
assertEquals(response.status_code, 200)
|
||||
if response.status_code == 200:
|
||||
print("\033[92mPassed!")
|
||||
else:
|
||||
print("\033[91mFailed!")
|
||||
|
||||
#STATS
|
||||
#PARTIAL
|
||||
print("\033[94mTesting partial grades stats...")
|
||||
response = client.post(reverse('partial'), content_type='application/xml', data=json.dumps(cookies_data))
|
||||
assertEquals(response.status_code, 200)
|
||||
if response.status_code == 200:
|
||||
print("\033[92mPassed!")
|
||||
else:
|
||||
print("\033[91mFailed!")
|
||||
|
||||
#YEAR
|
||||
print("\033[94mTesting year grades stats...")
|
||||
response = client.post(reverse('year'), content_type='application/xml', data=json.dumps(cookies_data))
|
||||
assertEquals(response.status_code, 200)
|
||||
if response.status_code == 200:
|
||||
print("\033[92mPassed!")
|
||||
else:
|
||||
print("\033[91mFailed!")
|
||||
|
||||
#SEND MESSAGE
|
||||
print("\033[94mTesting sending message...")
|
||||
for recipient in recipients:
|
||||
send_data = {
|
||||
'cookies_data': json.dumps(cookies_data),
|
||||
|
@ -139,8 +251,13 @@ def get_data_test(client, cookies_data, assertEquals):
|
|||
}
|
||||
response = client.post(reverse('send_message'), content_type='application/xml', data=json.dumps(send_data))
|
||||
assertEquals(response.status_code, 200)
|
||||
if response.status_code == 200:
|
||||
print("\033[92mPassed!")
|
||||
else:
|
||||
print("\033[91mFailed!")
|
||||
|
||||
#GETTING MESSAGE CONTENT
|
||||
print("\033[94mTesting getting content of message...")
|
||||
for id in messages_ids:
|
||||
send_data = {
|
||||
'cookies_data': json.dumps(cookies_data),
|
||||
|
@ -148,8 +265,17 @@ def get_data_test(client, cookies_data, assertEquals):
|
|||
}
|
||||
response = client.post(reverse('message_content'), content_type='application/xml', data=json.dumps(send_data))
|
||||
assertEquals(response.status_code, 200)
|
||||
if response.status_code == 200:
|
||||
print("\033[92mPassed!")
|
||||
else:
|
||||
print("\033[91mFailed!")
|
||||
|
||||
def log_out_test(client, assertEquals):
|
||||
#LOG OUT
|
||||
print("\033[94mTesting logging out...")
|
||||
response = client.get(reverse('log_out'), content_type='application/xml')
|
||||
assertEquals(response.status_code, 200)
|
||||
assertEquals(response.status_code, 200)
|
||||
if response.status_code == 200:
|
||||
print("\033[92mPassed!")
|
||||
else:
|
||||
print("\033[91mFailed!")
|
||||
|
|
Loading…
Reference in a new issue