sapling/tests/test-phabstatus.t
Jun Wu 8a3a99ba21 hgext: move single file extensions to hgext3rd
Summary:
Be a better citizen under system python path.

Fix all tests issues and change setup.py to use glob pattern to include
all extensions.

Test Plan:
Run tests and `make local`.
Also build and install the package and run `hg sl` in major repos.

Reviewers: #mercurial, ttung, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, durham, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3534311

Signature: t1:3534311:1468275426:fe122646c8bd6c541e1889e73e9df28f86747ff2
2016-07-08 13:15:42 +01:00

60 lines
1.7 KiB
Perl

Setup
$ PYTHONPATH=$TESTDIR/..:$PYTHONPATH
$ export PYTHONPATH
$ cat >> $HGRCPATH << EOF
> [extensions]
> arcconfig=$TESTDIR/../phabricator/arcconfig.py
> phabstatus=$TESTDIR/../hgext3rd/phabstatus.py
> smartlog=$TESTDIR/../hgext3rd/smartlog.py
> EOF
$ hg init repo
$ cd repo
$ touch foo
$ hg ci -qAm 'Differential Revision: https://phabricator.fb.com/D1'
With an invalid arc configuration
$ hg log -T '{phabstatus}\n' -r .
arcconfig configuration problem. No diff information can be provided.
Error info: no .arcconfig foundError
Configure arc...
$ echo '{}' > .arcconfig
$ echo '{}' > .arcrc
And now with bad responses:
$ cat > $TESTTMP/mockduit << EOF
> [{"cmd": ["differential.query", {"ids": ["1"]}], "result": {}}]
> EOF
$ HG_ARC_CONDUIT_MOCK=$TESTTMP/mockduit hg log -T '{phabstatus}\n' -r .
Error
$ cat > $TESTTMP/mockduit << EOF
> [{"cmd": ["differential.query", {"ids": ["1"]}], "error_info": "failed, yo"}]
> EOF
$ HG_ARC_CONDUIT_MOCK=$TESTTMP/mockduit hg log -T '{phabstatus}\n' -r .
Error talking to phabricator. No diff information can be provided.
Error info: failed, yoError
Missing id field is treated as an error
$ cat > $TESTTMP/mockduit << EOF
> [{"cmd": ["differential.query", {"ids": ["1"]}],
> "result": [{"statusName": "Needs Review"}]}]
> EOF
$ HG_ARC_CONDUIT_MOCK=$TESTTMP/mockduit hg log -T '{phabstatus}\n' -r .
Error
And finally, the success case
$ cat > $TESTTMP/mockduit << EOF
> [{"cmd": ["differential.query", {"ids": ["1"]}],
> "result": [{"id": 1, "statusName": "Needs Review"}]}]
> EOF
$ HG_ARC_CONDUIT_MOCK=$TESTTMP/mockduit hg log -T '{phabstatus}\n' -r .
Needs Review