sapling/eden/integration/hg/status_test.py
Michael Bolin f766fe0a87 Update Hg integration tests to use assert_status().
Summary:
`HgExtensionTestBase.assert_status()` was added in D4814422, but it was only
applied to `update_test.py`. This change updates the docstring (it appears to
have been copy/pasted from a nearby method), and makes use of it in the other
integration tests.

Reviewed By: wez

Differential Revision: D5050775

fbshipit-source-id: bb70740b6f455a84e7a22c3286c8ddbe2462f816
2017-05-12 09:19:57 -07:00

46 lines
1.3 KiB
Python

#!/usr/bin/env python3
#
# Copyright (c) 2016-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
from .lib.hg_extension_test_base import HgExtensionTestBase
class StatusTest(HgExtensionTestBase):
def populate_backing_repo(self, repo):
repo.write_file('hello.txt', 'hola')
repo.commit('Initial commit.')
def test_status(self):
'''Test various `hg status` states in the root of an Eden mount.'''
self.assert_status_empty()
self.touch('world.txt')
self.assert_status({'world.txt': '?'})
self.hg('add', 'world.txt')
self.assert_status({'world.txt': 'A'})
self.rm('hello.txt')
self.assert_status({
'hello.txt': '!',
'world.txt': 'A',
})
with open(self.get_path('hello.txt'), 'w') as f:
f.write('new contents')
self.assert_status({
'hello.txt': 'M',
'world.txt': 'A',
})
self.hg('rm', '--force', 'hello.txt')
self.assert_status({
'hello.txt': 'R',
'world.txt': 'A',
})