Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Nicholas Bailey
rust-gitlab
Commits
5352103c
Commit
5352103c
authored
Oct 14, 2019
by
Ben Boeckel
⛰
Browse files
tests: test that the date returned is the expected one
parent
80a8a1ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/test/webhooks.rs
View file @
5352103c
...
...
@@ -4,13 +4,26 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use
crates
::
chrono
::{
TimeZone
,
Utc
};
use
crates
::
serde_json
::
from_str
;
use
webhooks
::
*
;
#[test]
fn
test_hookdate_deserialize
()
{
let
_hook
:
HookDate
=
from_str
(
"
\"
2019-01-20 15:00:12 UTC
\"
"
)
.unwrap
();
let
_hook
:
HookDate
=
from_str
(
"
\"
2019-03-01T19:39:17Z
\"
"
)
.unwrap
();
let
_hook
:
HookDate
=
from_str
(
"
\"
2019-03-01T17:50:02.036-05:00
\"
"
)
.unwrap
();
let
hook
:
HookDate
=
from_str
(
"
\"
2019-01-20 15:00:12 UTC
\"
"
)
.unwrap
();
assert_eq!
(
*
hook
.as_ref
(),
Utc
.ymd
(
2019
,
1
,
20
)
.and_hms_milli
(
15
,
00
,
12
,
0
),
);
let
hook
:
HookDate
=
from_str
(
"
\"
2019-03-01T19:39:17Z
\"
"
)
.unwrap
();
assert_eq!
(
*
hook
.as_ref
(),
Utc
.ymd
(
2019
,
3
,
1
)
.and_hms_milli
(
19
,
39
,
17
,
0
),
);
let
hook
:
HookDate
=
from_str
(
"
\"
2019-03-01T17:50:02.036-05:00
\"
"
)
.unwrap
();
assert_eq!
(
*
hook
.as_ref
(),
Utc
.ymd
(
2019
,
3
,
1
)
.and_hms_milli
(
22
,
50
,
2
,
36
),
);
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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