File tree 1 file changed +36
-0
lines changed
1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ """
2
+ Tests for user-reported issues.
3
+ """
4
+
5
+ import json
6
+ from pathlib import Path
7
+
8
+ from pact import MessageConsumer , Provider , matchers
9
+
10
+
11
+ def test_github_850 () -> None :
12
+ """
13
+ See https://github.com/pact-foundation/pact-python/issues/850.
14
+ """
15
+ contract = MessageConsumer ("my_contract_consumer" ).has_pact_with (
16
+ Provider ("my_contract_provider" ),
17
+ pact_dir = "pacts" ,
18
+ )
19
+
20
+ event_data = {
21
+ "invoice_id" : "12345" ,
22
+ "amount" : 100.00 ,
23
+ "currency" : "USD" ,
24
+ "created" : matchers .Format ().iso_8601_datetime (),
25
+ }
26
+
27
+ contract .given ("Create contract" ).expects_to_receive (
28
+ "An event of contract"
29
+ ).with_content (event_data )
30
+
31
+ with contract :
32
+ pass
33
+
34
+ with Path ("pacts/my_contract_consumer-my_contract_provider.json" ).open () as f :
35
+ data = json .load (f )
36
+ assert data ["messages" ][0 ]["contents" ]["created" ] == "1991-02-20T06:35:26+00:00"
You can’t perform that action at this time.
0 commit comments