Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
R
red-ci-cd
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
red-group-test
red-ci-cd
Commits
21270bce
Commit
21270bce
authored
Apr 14, 2020
by
John Red Medrano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new file
parent
975449ee
Pipeline
#439
failed
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
0 deletions
+60
-0
test.py
test.py
+60
-0
No files found.
test.py
0 → 100644
View file @
21270bce
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/1/ddd'
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_404_NOT_FOUND
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment