def test_branch(self, util_mock): gerrit_client.main([ 'branch', '--host', 'https://example.org/foo', '--project', 'projectname', '--branch', 'branchname', '--commit', 'commitname' ]) util_mock.assert_called_once_with('example.org', 'projectname', 'branchname', 'commitname')
def test_changeedit(self, util_mock): open().read.return_value = 'test_data' gerrit_client.main([ 'changeedit', '--host', 'https://example.org/foo', '--change', '1', '--path', 'path/to/file', '--file', '/my/foo' ]) util_mock.assert_called_once_with('example.org', 1, 'path/to/file', 'test_data')
def test_relatedchanges(self, util_mock): gerrit_client.main([ 'relatedchanges', '--host', 'https://example.org/foo', '--change', 'foo-change-id', '--revision', 'foo-revision-id' ]) util_mock.assert_called_once_with('example.org', change='foo-change-id', revision='foo-revision-id')
def test_changes(self, util_mock): gerrit_client.main([ 'changes', '--host', 'https://example.org/foo', '-p', 'foo=bar', '-p', 'baz=qux', '--limit', '10', '--start', '20', '-o', 'op1', '-o', 'op2' ]) util_mock.assert_called_once_with('example.org', [('foo', 'bar'), ('baz', 'qux')], limit=10, start=20, o_params=['op1', 'op2'])
def test_createchange(self, util_mock): gerrit_client.main([ 'createchange', '--host', 'https://example.org/foo', '--project', 'project', '--branch', 'main', '--subject', 'subject', '-p', 'work_in_progress=true' ]) util_mock.assert_called_once_with('example.org', 'project', branch='main', subject='subject', params=[('work_in_progress', 'true') ])
def test_abandon(self, util_mock): gerrit_client.main([ 'abandon', '--host', 'https://example.org/foo', '-c', '1', '-m', 'bar' ]) util_mock.assert_called_once_with('example.org', 1, 'bar')
def test_publishchangeedit(self, util_mock): gerrit_client.main([ 'publishchangeedit', '--host', 'https://example.org/foo', '--change', '1', '--notify', 'yes' ]) util_mock.assert_called_once_with('example.org', 1, 'yes')