FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-react/tests/test_django_integration.py at master · markfinger/python-react · GitHub
markfinger
/
python-react
Public
Notifications
You must be signed in to change notification settings
Fork
115
Star
1.6k
Code
Issues
7
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
python-react
/
tests
/
test_django_integration.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
43 lines (37 loc) · 1.43 KB
Breadcrumbs
python-react
/
tests
/
test_django_integration.py
Copy path
File metadata and controls
43 lines (37 loc) · 1.43 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import
json
import
datetime
from
django
.
test
import
TestCase
from
django
.
utils
import
timezone
from
optional_django
.
env
import
DJANGO_CONFIGURED
from
react
.
render
import
render_component
from
react
import
conf
from
.
settings
import
Components
class
TestDjangoIntegration
(
TestCase
):
__test__
=
DJANGO_CONFIGURED
def
test_can_serialize_datetime_values_in_props
(
self
):
component
=
render_component
(
Components
.
HELLO_WORLD_JSX
,
{
'name'
:
'world!'
,
'datetime'
:
datetime
.
datetime
(
2015
,
1
,
2
,
3
,
4
,
5
,
tzinfo
=
timezone
.
utc
),
'date'
:
datetime
.
date
(
2015
,
1
,
2
),
'time'
:
datetime
.
time
(
3
,
4
,
5
),
},
)
deserialized
=
json
.
loads
(
component
.
props
)
self
.
assertEqual
(
deserialized
,
{
'name'
:
'world!'
,
'datetime'
:
'2015-01-02T03:04:05Z'
,
'date'
:
'2015-01-02'
,
'time'
:
'03:04:05'
,
}
)
def
test_relative_paths_are_resolved_via_the_static_file_finder
(
self
):
component
=
render_component
(
Components
.
DJANGO_REL_PATH
,
to_static_markup
=
True
)
self
.
assertEqual
(
str
(
component
),
'<span>You found me.</span>'
)
def
test_django_settings_are_proxied
(
self
):
self
.
assertEqual
(
conf
.
settings
.
RENDER
,
True
)
with
self
.
settings
(
REACT
=
{
'RENDER'
:
False
}):
self
.
assertEqual
(
conf
.
settings
.
RENDER
,
False
)
Back
|
FazBrowse Home
|
New Git URL