Commit 2d51fb4a authored by John Red Medrano's avatar John Red Medrano

added fixtures

parent 924c7f64
This diff is collapsed.
This diff is collapsed.
from rest_framework import status
from rest_framework.test import APITestCase
from rest_framework.test import force_authenticate
from rest_framework.test import APIClient
# from api.models import ChatRoom
class ChatRoomTest(APITestCase):
def test_login(self):
self.url = '/api/v1/auth/login/'
self.body = {
"username": 'superuser',
'password': 'password123'
}
request = self.client.post(self.url, self.body, format='multipart')
print(request.json())
self.access_token = request.json()['token']
self.assertEqual(request.status_code, status.HTTP_200_OK)
def test_companies(self):
self.url = '/api/v1/master/companies/'
self.client = APIClient()
self.client.credentials(HTTP_AUTHORIZATION='Bearer ' + self.access_token)
request = self.client.get(self.url, format='json')
self.assertEqual(request.status_code, status.HTTP_200_OK)
from rest_framework import status
from rest_framework.test import APITestCase
from rest_framework.test import force_authenticate
from rest_framework.test import APIClient
from app.entities.models import User
# from api.models import ChatRoom
class ChatRoomTest(APITestCase):
fixtures = ['red-dump2.json']
def test_login2(self):
self.url = '/api/v1/auth/login/'
self.body = {
"username": 'superuser',
'password': 'password123'
}
request = self.client.post(self.url, self.body, format='multipart')
self.assertEqual(request.status_code, status.HTTP_200_OK)
# def test_login(self):
# self.url = '/api/v1/auth/login/'
# self.body = {
# "username": 'superuse2r',
# 'password': 'password123'
# }
# request = self.client.post(self.url, self.body, format='multipart')
# self.assertEqual(request.status_code, status.HTTP_400_BAD_REQUEST)
def test_companies(self):
self.url = '/api/v1/master/companies/'
self.client = APIClient()
self.client.credentials(HTTP_AUTHORIZATION='Bearer 8b6d17d859bef3c660d516d9dde982ba73e74de0')
request = self.client.get(self.url, format='json')
self.assertEqual(request.status_code, status.HTTP_200_OK)
# def test_companies_slug(self):
# self.url = '/api/v1/master/companies/1/'
# self.client = APIClient()
# self.client.credentials(HTTP_AUTHORIZATION='Bearer 8b6d17d859bef3c660d516d9dde982ba73e74de0')
# request = self.client.get(self.url, format='json')
# self.assertEqual(request.status_code, status.HTTP_200_OK)
def test_companies_slug_error(self):
self.url = '/api/v1/master/companies/100/'
self.client = APIClient()
self.client.credentials(HTTP_AUTHORIZATION='Bearer 8b6d17d859bef3c660d516d9dde982ba73e74de0')
request = self.client.get(self.url, format='json')
self.assertEqual(request.status_code, status.HTTP_400_BAD_REQUEST)
def test_companies_slug_correct(self):
self.url = '/api/v1/master/companies/1/'
self.client = APIClient()
self.client.credentials(HTTP_AUTHORIZATION='Bearer 8b6d17d859bef3c660d516d9dde982ba73e74de0')
request = self.client.get(self.url, format='json')
self.assertEqual(request.status_code, status.HTTP_200_OK)
[{"model": "entities.application", "pk": 1, "fields": {"created": "2019-09-23T12:43:33.754", "createdby": "superuser", "modified": "2019-09-23T12:43:33.754", "modifiedby": "superuser", "code": "APP-20190923-0000001", "name": "Resource Management System", "excel_code": "rms"}}, {"model": "entities.application", "pk": 2, "fields": {"created": "2019-09-23T12:43:40.512", "createdby": "superuser", "modified": "2019-09-23T12:43:40.512", "modifiedby": "superuser", "code": "APP-20190923-0000002", "name": "Change Management System", "excel_code": "cms"}}, {"model": "entities.application", "pk": 3, "fields": {"created": "2019-09-23T12:43:55.957", "createdby": "superuser", "modified": "2019-09-23T12:43:55.957", "modifiedby": "superuser", "code": "APP-20190923-0000003", "name": "Asset Management System", "excel_code": "ams"}}, {"model": "entities.module", "pk": 1, "fields": {"created": "2019-09-27T12:49:27.795", "createdby": "superuser", "modified": "2019-09-27T12:49:27.795", "modifiedby": "superuser", "application": "APP-20190923-0000001", "code": "MODULE-20190927-0000001", "name": "Application Management", "parent": null, "sort_id": 1, "component": "rms/application-management"}}, {"model": "entities.module", "pk": 2, "fields": {"created": "2019-09-27T12:49:31.756", "createdby": "superuser", "modified": "2019-09-27T13:00:57.280", "modifiedby": "superuser", "application": "APP-20190923-0000001", "code": "MODULE-20190927-0000002", "name": "Company Management", "parent": null, "sort_id": 6, "component": "rms/company-management"}}, {"model": "entities.module", "pk": 3, "fields": {"created": "2019-09-27T12:49:49.528", "createdby": "superuser", "modified": "2019-09-27T13:00:18.423", "modifiedby": "superuser", "application": "APP-20190923-0000001", "code": "MODULE-20190927-0000003", "name": "Department Management", "parent": null, "sort_id": 10, "component": "rms/department-management"}}, {"model": "entities.module", "pk": 4, "fields": {"created": "2019-09-27T12:49:57.378", "createdby": "superuser", "modified": "2019-09-27T12:58:07.634", "modifiedby": "superuser", "application": "APP-20190923-0000001", "code": "MODULE-20190927-0000004", "name": "Module Management", "parent": null, "sort_id": 11, "component": "rms/module-management"}}, {"model": "entities.module", "pk": 5, "fields": {"created": "2019-09-27T12:50:01.383", "createdby": "superuser", "modified": "2019-09-30T14:37:53.210", "modifiedby": "superuser", "application": "APP-20190923-0000001", "code": "MODULE-20190927-0000005", "name": "User Management", "parent": null, "sort_id": 12, "component": "rms/user-management"}}, {"model": "entities.module", "pk": 6, "fields": {"created": "2019-09-27T12:50:15.910", "createdby": "superuser", "modified": "2019-09-27T19:04:53.805", "modifiedby": "superuser", "application": "APP-20190923-0000002", "code": "MODULE-20190927-0000006", "name": "Change Request Template", "parent": null, "sort_id": 7, "component": "cms/change-request/template"}}, {"model": "entities.module", "pk": 10, "fields": {"created": "2019-09-28T12:28:20.174", "createdby": "superuser", "modified": "2019-09-30T14:38:38.604", "modifiedby": "superuser", "application": "APP-20190923-0000002", "code": "MODULE-20190928-0000010", "name": "Change Request Form", "parent": null, "sort_id": 6, "component": "cms/change-request/form"}}, {"model": "entities.module", "pk": 11, "fields": {"created": "2019-09-30T17:15:33.022", "createdby": "superuser", "modified": "2019-09-30T17:15:33.022", "modifiedby": "superuser", "application": "APP-20190923-0000002", "code": "MODULE-20190930-0000011", "name": "Notification", "parent": null, "sort_id": 1, "component": "cms/notifications"}}, {"model": "entities.module", "pk": 19, "fields": {"created": "2019-11-07T17:27:21.486", "createdby": "superuser", "modified": "2019-11-07T17:27:21.486", "modifiedby": "superuser", "application": "APP-20190923-0000001", "code": "MODULE-20191107-0000019", "name": "Delegation Management", "parent": null, "sort_id": 13, "component": "rms/delegation-management"}}, {"model": "entities.module", "pk": 20, "fields": {"created": "2020-03-19T11:43:06.231", "createdby": "superuser", "modified": "2020-03-19T11:43:06.231", "modifiedby": "superuser", "application": "APP-20190923-0000003", "code": "MODULE-20200319-0000020", "name": "Asset Group", "parent": null, "sort_id": 2, "component": "ams/asset-groups"}}, {"model": "entities.module", "pk": 21, "fields": {"created": "2020-03-19T11:43:41.894", "createdby": "superuser", "modified": "2020-03-19T11:43:41.894", "modifiedby": "superuser", "application": "APP-20190923-0000003", "code": "MODULE-20200319-0000021", "name": "Asset", "parent": null, "sort_id": 3, "component": "ams/assets"}}, {"model": "entities.module", "pk": 22, "fields": {"created": "2020-03-19T11:55:27.206", "createdby": "superuser", "modified": "2020-03-19T11:55:27.206", "modifiedby": "superuser", "application": "APP-20190923-0000003", "code": "MODULE-20200319-0000022", "name": "Asset Stock", "parent": null, "sort_id": 4, "component": "ams/asset-stock"}}, {"model": "entities.module", "pk": 23, "fields": {"created": "2020-03-19T11:55:53.847", "createdby": "superuser", "modified": "2020-03-19T11:55:53.847", "modifiedby": "superuser", "application": "APP-20190923-0000003", "code": "MODULE-20200319-0000023", "name": "Report", "parent": null, "sort_id": 5, "component": "ams/report"}}, {"model": "entities.module", "pk": 24, "fields": {"created": "2020-03-19T11:56:26.634", "createdby": "superuser", "modified": "2020-03-19T11:56:26.635", "modifiedby": "superuser", "application": "APP-20190923-0000003", "code": "MODULE-20200319-0000024", "name": "Asset Type", "parent": null, "sort_id": 8, "component": "ams/asset-type-templates"}}, {"model": "entities.module", "pk": 25, "fields": {"created": "2020-03-19T11:56:46.268", "createdby": "superuser", "modified": "2020-03-19T11:56:46.268", "modifiedby": "superuser", "application": "APP-20190923-0000003", "code": "MODULE-20200319-0000025", "name": "Report Type", "parent": null, "sort_id": 9, "component": "ams/report-type"}}, {"model": "entities.delegation", "pk": 1, "fields": {"created": "2019-11-19T17:46:08.984", "createdby": "superuser", "modified": "2019-11-19T17:46:08.984", "modifiedby": "superuser", "code": "DELEGATION-20191119-0000001", "name": "Requestor"}}, {"model": "entities.delegation", "pk": 2, "fields": {"created": "2019-11-19T17:46:18.010", "createdby": "superuser", "modified": "2019-11-19T17:46:18.010", "modifiedby": "superuser", "code": "DELEGATION-20191119-0000002", "name": "Vendor/Implementor"}}, {"model": "entities.delegation", "pk": 3, "fields": {"created": "2019-11-19T17:46:26.168", "createdby": "superuser", "modified": "2019-11-22T10:03:40.605", "modifiedby": "superuser", "code": "DELEGATION-20191119-0000003", "name": "Head of Department"}}, {"model": "entities.delegation", "pk": 4, "fields": {"created": "2019-11-19T17:46:34.020", "createdby": "superuser", "modified": "2019-11-19T17:46:34.020", "modifiedby": "superuser", "code": "DELEGATION-20191119-0000004", "name": "SD/OD"}}, {"model": "entities.delegation", "pk": 5, "fields": {"created": "2019-11-19T17:46:41.461", "createdby": "superuser", "modified": "2019-11-19T17:46:41.462", "modifiedby": "superuser", "code": "DELEGATION-20191119-0000005", "name": "Change Control Board"}}, {"model": "entities.delegation", "pk": 6, "fields": {"created": "2019-11-19T17:46:49.472", "createdby": "superuser", "modified": "2019-11-19T17:46:49.472", "modifiedby": "superuser", "code": "DELEGATION-20191119-0000006", "name": "Approver"}}, {"model": "entities.company", "pk": 1, "fields": {"created": "2019-09-23T12:45:31.058", "createdby": "superuser", "modified": "2019-10-01T18:10:40.098", "modifiedby": "superuser", "code": "COMPANY-20190923-0000001", "name": "Oneberry Technologies Pte Ltd", "contact_details": "2152509"}}, {"model": "entities.department", "pk": 1, "fields": {"created": "2019-09-23T12:45:52.531", "createdby": "superuser", "modified": "2019-10-01T18:12:27.956", "modifiedby": "superuser", "company": "COMPANY-20190923-0000001", "code": "DEPARTMENT-20190923-0000001", "name": "Super User", "delegation": []}}, {"model": "entities.user", "pk": 1, "fields": {"last_login": "2020-01-13T21:50:01.985", "is_superuser": true, "first_name": "", "last_name": "", "is_staff": true, "is_active": true, "date_joined": "2019-09-23T12:42:37.938", "department": "DEPARTMENT-20190923-0000001", "default_app": "APP-20190923-0000001", "user_type": "SU", "code": "USER-20190923-0000001", "name": "", "username": "superuser", "password": "pbkdf2_sha256$150000$YLmqqWBQGsJG$r4NYkY05q1zlmgzh106ejBbzd0NY00YEfylllyVQyk0=", "doa": null, "contact_no": null, "email": "jeffrey@tirsolutions.com", "groups": [], "user_permissions": [], "application": [1, 2, 3]}}, {"model": "entities.userimage", "pk": 5, "fields": {"created": "2020-02-21T18:14:44.307", "createdby": "superuser", "modified": "2020-02-21T18:14:44.307", "modifiedby": "superuser", "user": "USER-20190923-0000001", "name": "_profile_pic.png", "image": "user_images/_profile_pic.png", "is_primary": true}}]
\ No newline at end of file
This diff is collapsed.
environ({'ACLOCAL_PATH': 'C:\\Program Files\\Git\\mingw64\\share\\aclocal;C:\\Program Files\\Git\\usr\\share\\aclocal', 'ALLUSERSPROFILE': 'C:\\ProgramData', 'APPDATA': 'C:\\Users\\Red Medrano\\AppData\\Roaming', 'APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL': 'true', 'COMMONPROGRAMFILES': 'C:\\Program Files\\Common Files', 'COMMONPROGRAMFILES(X86)': 'C:\\Program Files (x86)\\Common Files', 'COMMONPROGRAMW6432': 'C:\\Program Files\\Common Files', 'COMPUTERNAME': 'DESKTOP-JFRHM4F', 'COMSPEC': 'C:\\WINDOWS\\system32\\cmd.exe', 'CONFIG_SITE': 'C:/Program Files/Git/mingw64/etc/config.site', 'DISPLAY': 'needs-to-be-defined', 'DRIVERDATA': 'C:\\Windows\\System32\\Drivers\\DriverData', 'ERLANG_HOME': 'C:\\Program Files\\erl10.4', 'EXEPATH': 'C:\\Program Files\\Git', 'FPS_BROWSER_APP_PROFILE_STRING': 'Internet Explorer', 'FPS_BROWSER_USER_PROFILE_STRING': 'Default', 'HOME': 'C:\\Users\\Red Medrano', 'HOMEDRIVE': 'C:', 'HOMEPATH': '\\Users\\Red Medrano', 'HOSTNAME': 'DESKTOP-JFRHM4F', 'INFOPATH': 'C:\\Program Files\\Git\\usr\\local\\info;C:\\Program Files\\Git\\usr\\share\\info;C:\\Program Files\\Git\\usr\\info;C:\\Program Files\\Git\\share\\info', 'LANG': 'en_US.UTF-8', 'LOCALAPPDATA': 'C:\\Users\\Red Medrano\\AppData\\Local', 'LOGONSERVER': '\\\\DESKTOP-JFRHM4F', 'MANPATH': 'C:\\Program Files\\Git\\mingw64\\local\\man;C:\\Program Files\\Git\\mingw64\\share\\man;C:\\Program Files\\Git\\usr\\local\\man;C:\\Program Files\\Git\\usr\\share\\man;C:\\Program Files\\Git\\usr\\man;C:\\Program Files\\Git\\share\\man', 'MINGW_CHOST': 'x86_64-w64-mingw32', 'MINGW_PACKAGE_PREFIX': 'mingw-w64-x86_64', 'MINGW_PREFIX': 'C:/Program Files/Git/mingw64', 'MSYSTEM': 'MINGW64', 'MSYSTEM_CARCH': 'x86_64', 'MSYSTEM_CHOST': 'x86_64-w64-mingw32', 'MSYSTEM_PREFIX': 'C:/Program Files/Git/mingw64', 'NUMBER_OF_PROCESSORS': '8', 'ONEDRIVE': 'C:\\Users\\Red Medrano\\OneDrive', 'ONEDRIVECONSUMER': 'C:\\Users\\Red Medrano\\OneDrive', 'ORIGINAL_PATH': 'C:\\Program Files\\Git\\mingw64\\bin;C:\\Program Files\\Git\\usr\\bin;C:\\Users\\Red Medrano\\bin;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0;C:\\WINDOWS\\System32\\OpenSSH;C:\\Program Files\\MariaDB 10.3\\bin;C:\\Program Files\\Git\\cmd;C:\\Program Files\\nodejs;C:\\Program Files\\PuTTY;C:\\Program Files\\Microsoft VS Code\\bin;C:\\Program Files\\Docker\\Docker\\resources\\bin;C:\\ProgramData\\DockerDesktop\\version-bin;C:\\Users\\Red Medrano\\AppData\\Local\\Programs\\Python\\Python37\\Scripts;C:\\Users\\Red Medrano\\AppData\\Local\\Programs\\Python\\Python37;C:\\Users\\Red Medrano\\AppData\\Local\\Programs\\Python\\Python36\\Scripts;C:\\Users\\Red Medrano\\AppData\\Local\\Programs\\Python\\Python36;C:\\Users\\Red Medrano\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\Red Medrano\\AppData\\Roaming\\npm;C:\\Program Files\\JetBrains\\PyCharm Community Edition 2019.1.3\\bin', 'ORIGINAL_TEMP': 'C:/Users/REDMED~1/AppData/Local/Temp', 'ORIGINAL_TMP': 'C:/Users/REDMED~1/AppData/Local/Temp', 'OS': 'Windows_NT', 'PATH': 'C:\\Users\\Red Medrano\\bin;C:\\Program Files\\Git\\mingw64\\bin;C:\\Program Files\\Git\\usr\\local\\bin;C:\\Program Files\\Git\\usr\\bin;C:\\Program Files\\Git\\usr\\bin;C:\\Program Files\\Git\\mingw64\\bin;C:\\Program Files\\Git\\usr\\bin;C:\\Users\\Red Medrano\\bin;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0;C:\\WINDOWS\\System32\\OpenSSH;C:\\Program Files\\MariaDB 10.3\\bin;C:\\Program Files\\Git\\cmd;C:\\Program Files\\nodejs;C:\\Program Files\\PuTTY;C:\\Program Files\\Microsoft VS Code\\bin;C:\\Program Files\\Docker\\Docker\\resources\\bin;C:\\ProgramData\\DockerDesktop\\version-bin;C:\\Users\\Red Medrano\\AppData\\Local\\Programs\\Python\\Python37\\Scripts;C:\\Users\\Red Medrano\\AppData\\Local\\Programs\\Python\\Python37;C:\\Users\\Red Medrano\\AppData\\Local\\Programs\\Python\\Python36\\Scripts;C:\\Users\\Red Medrano\\AppData\\Local\\Programs\\Python\\Python36;C:\\Users\\Red Medrano\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\Red Medrano\\AppData\\Roaming\\npm;C:\\Program Files\\JetBrains\\PyCharm Community Edition 2019.1.3\\bin;C:\\Program Files\\Git\\usr\\bin\\vendor_perl;C:\\Program Files\\Git\\usr\\bin\\core_perl', 'PATHEXT': '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC', 'PKG_CONFIG_PATH': 'C:\\Program Files\\Git\\mingw64\\lib\\pkgconfig;C:\\Program Files\\Git\\mingw64\\share\\pkgconfig', 'PLINK_PROTOCOL': 'ssh', 'PROCESSOR_ARCHITECTURE': 'AMD64', 'PROCESSOR_IDENTIFIER': 'Intel64 Family 6 Model 94 Stepping 3, GenuineIntel', 'PROCESSOR_LEVEL': '6', 'PROCESSOR_REVISION': '5e03', 'PROGRAMDATA': 'C:\\ProgramData', 'PROGRAMFILES': 'C:\\Program Files', 'PROGRAMFILES(X86)': 'C:\\Program Files (x86)', 'PROGRAMW6432': 'C:\\Program Files', 'PROMPT': '$P$G', 'PSMODULEPATH': 'C:\\Program Files\\WindowsPowerShell\\Modules;C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules', 'PUBLIC': 'C:\\Users\\Public', 'PWD': 'C:/Users/Red Medrano/Desktop/CI', 'PYCHARM COMMUNITY EDITION': 'C:\\Program Files\\JetBrains\\PyCharm Community Edition 2019.1.3\\bin;', 'SESSIONNAME': 'Console', 'SHELL': 'C:\\Program Files\\Git\\usr\\bin\\bash.exe', 'SHLVL': '2', 'SSH_ASKPASS': 'C:/Program Files/Git/mingw64/libexec/git-core/git-gui--askpass', 'SYSTEMDRIVE': 'C:', 'SYSTEMROOT': 'C:\\WINDOWS', 'TEMP': 'C:\\Users\\REDMED~1\\AppData\\Local\\Temp', 'TERM': 'xterm', 'TMP': 'C:\\Users\\REDMED~1\\AppData\\Local\\Temp', 'TMPDIR': 'C:\\Users\\REDMED~1\\AppData\\Local\\Temp', 'USERDOMAIN': 'DESKTOP-JFRHM4F', 'USERDOMAIN_ROAMINGPROFILE': 'DESKTOP-JFRHM4F', 'USERNAME': 'Red Medrano', 'USERPROFILE': 'C:\\Users\\Red Medrano', 'WINDIR': 'C:\\WINDOWS', '_': 'C:/Program Files/Microsoft VS Code/Code.exe', 'TERM_PROGRAM': 'vscode', 'TERM_PROGRAM_VERSION': '1.42.1', 'COLORTERM': 'truecolor', 'DJANGO_SETTINGS_MODULE': 'config.settings.base'})
This diff is collapsed.
Markdown is supported
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