test\integration\test_state.py
-- -- --- --- --- --- --- --- ------- ------- ------- | """
-- -- --- --- --- --- --- --- ------- ------- ------- | This is really an integration test.
-- -- --- --- --- --- --- --- ------- ------- ------- | """
-- -- --- --- --- --- --- --- ------- ------- ------- | import pytest
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- -- --- --- --- --- --- --- ------- ------- ------- | import wily.config
-- -- --- --- --- --- --- --- ------- ------- ------- | import wily.state
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- -- --- --- --- --- --- --- ------- ------- ------- | @pytest.fixture
-- 01 000 000 000 000 000 000 0000.00 0000.00 0000.00 | def config(builddir):
-- 01 000 000 000 000 000 000 0000.00 0000.00 0000.00 | _cfg = wily.config.DEFAULT_CONFIG
-- 01 000 000 000 000 000 000 0000.00 0000.00 0000.00 | _cfg.path = builddir
-- 01 000 000 000 000 000 000 0000.00 0000.00 0000.00 | return _cfg
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- 01 003 004 003 006 007 009 0025.27 0056.85 0002.25 | def test_state_defaults(config):
-- -- 003 004 003 006 007 009 0025.27 0056.85 0002.25 | """Test the state defaults"""
-- -- 003 004 003 006 007 009 0025.27 0056.85 0002.25 | state = wily.state.State(config)
-- -- 003 004 003 006 007 009 0025.27 0056.85 0002.25 | assert state.index
-- -- 003 004 003 006 007 009 0025.27 0056.85 0002.25 | assert "git" in state.index
-- -- 003 004 003 006 007 009 0025.27 0056.85 0002.25 | assert state.default_archiver == "git"
-- -- 003 004 003 006 007 009 0025.27 0056.85 0002.25 | assert state.config is config
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- 02 003 008 004 008 011 012 0041.51 0062.27 0001.50 | def test_index(config):
-- 02 003 008 004 008 011 012 0041.51 0062.27 0001.50 | """Test the state index"""
-- 02 003 008 004 008 011 012 0041.51 0062.27 0001.50 | state = wily.state.State(config)
-- 02 003 008 004 008 011 012 0041.51 0062.27 0001.50 | assert state.index
-- 02 003 008 004 008 011 012 0041.51 0062.27 0001.50 | assert state.index["git"] is not None
-- 02 003 008 004 008 011 012 0041.51 0062.27 0001.50 |
-- 02 003 008 004 008 011 012 0041.51 0062.27 0001.50 | last_revision = state.index["git"].last_revision
-- 02 003 008 004 008 011 012 0041.51 0062.27 0001.50 | assert last_revision.revision.message == "remove line"
-- 02 003 008 004 008 011 012 0041.51 0062.27 0001.50 |
-- 02 003 008 004 008 011 012 0041.51 0062.27 0001.50 | for revision in state.index["git"].revisions:
-- -- 003 008 004 008 011 012 0041.51 0062.27 0001.50 | assert state.index["git"][revision.revision.key]
-- -- --- --- --- --- --- --- ------- ------- ------- | assert revision.revision in state.index["git"]
-- -- --- --- --- --- --- --- ------- ------- ------- | assert revision.revision.key in state.index["git"]