Mercurial > hg
comparison tests/test-phabricator.t @ 42268:af13e2088f77
phabricator: add custom vcr matcher to match request bodies
Currently when the phabricator extension's conduit output changes the tests
don't notice since the default vcr matcher only matches on 'method' and 'uri',
not the body.
Add a custom matcher that checks the same params are in the body (ignoring
ordering).
vcr's in-built body matcher can't be used since it fails under py3 with a
"UnicodeEncodeError" on the "€ in commit message" tests.
The DREV ids have decreased since the recordings were generated against a
different phabricator instance to avoid spamming mercurial-devel.
Differential Revision: https://phab.mercurial-scm.org/D6347
author | Ian Moody <moz-ian@perix.co.uk> |
---|---|
date | Sun, 05 May 2019 17:04:48 +0100 |
parents | a4f7dceb07bf |
children | 29528c4235a1 |
comparison
equal
deleted
inserted
replaced
42267:838f3a094b4f | 42268:af13e2088f77 |
---|---|
51 $ HGENCODING=utf-8; export HGENCODING | 51 $ HGENCODING=utf-8; export HGENCODING |
52 $ echo alpha > alpha | 52 $ echo alpha > alpha |
53 $ hg ci --addremove -m 'create alpha for phabricator test €' | 53 $ hg ci --addremove -m 'create alpha for phabricator test €' |
54 adding alpha | 54 adding alpha |
55 $ hg phabsend -r . --test-vcr "$VCR/phabsend-create-alpha.json" | 55 $ hg phabsend -r . --test-vcr "$VCR/phabsend-create-alpha.json" |
56 D6054 - created - d386117f30e6: create alpha for phabricator test \xe2\x82\xac (esc) | 56 D1190 - created - d386117f30e6: create alpha for phabricator test \xe2\x82\xac (esc) |
57 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/d386117f30e6-24ffe649-phabsend.hg | 57 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/d386117f30e6-24ffe649-phabsend.hg |
58 $ echo more >> alpha | 58 $ echo more >> alpha |
59 $ HGEDITOR=true hg ci --amend | 59 $ HGEDITOR=true hg ci --amend |
60 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/cb03845d6dd9-870f61a6-amend.hg | 60 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/a86ed7d85e86-b7a54f3b-amend.hg |
61 $ echo beta > beta | 61 $ echo beta > beta |
62 $ hg ci --addremove -m 'create beta for phabricator test' | 62 $ hg ci --addremove -m 'create beta for phabricator test' |
63 adding beta | 63 adding beta |
64 $ hg phabsend -r ".^::" --test-vcr "$VCR/phabsend-update-alpha-create-beta.json" | 64 $ hg phabsend -r ".^::" --test-vcr "$VCR/phabsend-update-alpha-create-beta.json" |
65 D6054 - updated - 939d862f0318: create alpha for phabricator test \xe2\x82\xac (esc) | 65 D1190 - updated - d940d39fb603: create alpha for phabricator test \xe2\x82\xac (esc) |
66 D6055 - created - f55f947ed0f8: create beta for phabricator test | 66 D1191 - created - 4b2486dfc8c7: create beta for phabricator test |
67 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/f55f947ed0f8-0d1e502e-phabsend.hg | 67 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/4b2486dfc8c7-d90584fa-phabsend.hg |
68 $ unset HGENCODING | 68 $ unset HGENCODING |
69 | 69 |
70 The amend won't explode after posting a public commit. The local tag is left | 70 The amend won't explode after posting a public commit. The local tag is left |
71 behind to identify it. | 71 behind to identify it. |
72 | 72 |
74 $ hg ci -m 'create public change for phabricator testing' | 74 $ hg ci -m 'create public change for phabricator testing' |
75 $ hg phase --public . | 75 $ hg phase --public . |
76 $ echo 'draft change' > alpha | 76 $ echo 'draft change' > alpha |
77 $ hg ci -m 'create draft change for phabricator testing' | 77 $ hg ci -m 'create draft change for phabricator testing' |
78 $ hg phabsend --amend -r '.^::' --test-vcr "$VCR/phabsend-create-public.json" | 78 $ hg phabsend --amend -r '.^::' --test-vcr "$VCR/phabsend-create-public.json" |
79 D5544 - created - a56e5ebd77e6: create public change for phabricator testing | 79 D1192 - created - 24ffd6bca53a: create public change for phabricator testing |
80 D5545 - created - 6a0ade3e3ec2: create draft change for phabricator testing | 80 D1193 - created - ac331633be79: create draft change for phabricator testing |
81 warning: not updating public commit 2:a56e5ebd77e6 | 81 warning: not updating public commit 2:24ffd6bca53a |
82 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/6a0ade3e3ec2-aca7d23c-phabsend.hg | 82 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/ac331633be79-719b961c-phabsend.hg |
83 $ hg tags -v | 83 $ hg tags -v |
84 tip 3:90532860b5e1 | 84 tip 3:a19f1434f9a5 |
85 D5544 2:a56e5ebd77e6 local | 85 D1192 2:24ffd6bca53a local |
86 | 86 |
87 $ hg debugcallconduit user.search --test-vcr "$VCR/phab-conduit.json" <<EOF | 87 $ hg debugcallconduit user.search --test-vcr "$VCR/phab-conduit.json" <<EOF |
88 > { | 88 > { |
89 > "constraints": { | 89 > "constraints": { |
90 > "isBot": true | 90 > "isBot": true |
105 } | 105 } |
106 } | 106 } |
107 | 107 |
108 Template keywords | 108 Template keywords |
109 $ hg log -T'{rev} {phabreview|json}\n' | 109 $ hg log -T'{rev} {phabreview|json}\n' |
110 3 {"id": "D5545", "url": "https://phab.mercurial-scm.org/D5545"} | 110 3 {"id": "D1193", "url": "https://phab.mercurial-scm.org/D1193"} |
111 2 {"id": "D5544", "url": "https://phab.mercurial-scm.org/D5544"} | 111 2 {"id": "D1192", "url": "https://phab.mercurial-scm.org/D1192"} |
112 1 {"id": "D6055", "url": "https://phab.mercurial-scm.org/D6055"} | 112 1 {"id": "D1191", "url": "https://phab.mercurial-scm.org/D1191"} |
113 0 {"id": "D6054", "url": "https://phab.mercurial-scm.org/D6054"} | 113 0 {"id": "D1190", "url": "https://phab.mercurial-scm.org/D1190"} |
114 | 114 |
115 $ hg log -T'{rev} {if(phabreview, "{phabreview.url} {phabreview.id}")}\n' | 115 $ hg log -T'{rev} {if(phabreview, "{phabreview.url} {phabreview.id}")}\n' |
116 3 https://phab.mercurial-scm.org/D5545 D5545 | 116 3 https://phab.mercurial-scm.org/D1193 D1193 |
117 2 https://phab.mercurial-scm.org/D5544 D5544 | 117 2 https://phab.mercurial-scm.org/D1192 D1192 |
118 1 https://phab.mercurial-scm.org/D6055 D6055 | 118 1 https://phab.mercurial-scm.org/D1191 D1191 |
119 0 https://phab.mercurial-scm.org/D6054 D6054 | 119 0 https://phab.mercurial-scm.org/D1190 D1190 |
120 | 120 |
121 $ cd .. | 121 $ cd .. |