Пример #1
0
 def test_snapshot_roundtrip(self):
     snapshot = [
         SnapshotItem('key1', ' \n\t/weird path \n', create_file_status()),
         SnapshotItem('key2', '\n another path', create_file_status())]
     serialized = FridgeCore.serialize_snapshot(snapshot)
     parsed = FridgeCore.parse_snapshot(serialized)
     assert snapshot == parsed
Пример #2
0
    def test_setting_and_getting_branch(self, fs):
        fridge = FridgeCore.init(os.curdir, fs)
        fridge.set_branch('test_branch', u'ab12cd')
        del fridge

        fridge = FridgeCore(os.curdir, fs)
        assert fridge.is_branch('test_branch')
        assert fridge.resolve_branch('test_branch') == u'ab12cd'
Пример #3
0
    def test_setting_and_getting_head(self, fs):
        fridge = FridgeCore.init(os.curdir, fs)
        fridge.set_head(Reference(Reference.COMMIT, u'ab12cd'))
        del fridge

        fridge = FridgeCore(os.curdir, fs)
        assert fridge.get_head() == Reference(Reference.COMMIT, u'ab12cd')
        assert fridge.get_head_key() == u'ab12cd'
Пример #4
0
    def test_writing_and_reading_snapshot(self, fs):
        s = self._create_snapshot()

        fridge = FridgeCore.init(os.curdir, fs)
        key = fridge.add_snapshot(s)
        del fridge

        fridge = FridgeCore(os.curdir, fs)
        assert s == fridge.read_snapshot(key)
Пример #5
0
    def test_writing_two_snapshots(self, fs):
        s1 = self._create_snapshot()
        s2 = [SnapshotItem('key', 'xyz', create_file_status())]

        fridge = FridgeCore.init(os.curdir, fs)
        key1 = fridge.add_snapshot(s1)
        key2 = fridge.add_snapshot(s2)
        assert s1 == fridge.read_snapshot(key1)
        assert s2 == fridge.read_snapshot(key2)
Пример #6
0
def fridge_core(fs):
    return FridgeCore.init(os.curdir, fs)