Example #1
0
    def it_should_fail_on_missing_repositories(config):
        shell.mkdir("deps")
        shell.rm(os.path.join("deps", "gitman_1"))

        with pytest.raises(InvalidRepository):
            gitman.lock()

        expect(config.__mapper__.text).does_not_contain("<unknown>")
Example #2
0
    def it_should_fail_on_dirty_repositories(config):
        expect(gitman.update(depth=1, lock=False)) == True
        shell.rm(os.path.join("deps", "gitman_1", ".project"))

        try:
            with pytest.raises(UncommittedChanges):
                gitman.lock()

            expect(config.__mapper__.text).does_not_contain("<dirty>")

        finally:
            shell.rm(os.path.join("deps", "gitman_1"))
Example #3
0
    def it_should_fail_on_invalid_repositories(config):
        shell.mkdir("deps")
        shell.rm(os.path.join("deps", "gitman_1", ".git"))
        shell.mkdir(os.path.join("deps", "gitman_1", ".git"))

        try:
            with pytest.raises(InvalidRepository):
                gitman.lock()

            expect(config.datafile.text).does_not_contain("<unknown>")

        finally:
            shell.rm(os.path.join("deps", "gitman_1"))
Example #4
0
    def it_records_all_versions_when_no_arguments(config):
        expect(gitman.update(depth=1, lock=False)) == True
        expect(gitman.lock()) == True

        expect(config.__mapper__.text) == CONFIG + strip("""
        sources_locked:
        - name: gitman_1
          repo: https://github.com/jacebrowning/gitman-demo
          rev: 1de84ca1d315f81b035cd7b0ecf87ca2025cdacd
          link:
          scripts:
          -
        - name: gitman_2
          repo: https://github.com/jacebrowning/gitman-demo
          rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04
          link:
          scripts:
          -
        - name: gitman_3
          repo: https://github.com/jacebrowning/gitman-demo
          rev: 9bf18e16b956041f0267c21baad555a23237b52e
          link:
          scripts:
          -
        """) == config.__mapper__.text
Example #5
0
    def it_records_specified_dependencies(config):
        expect(gitman.update(depth=1, lock=False)) == True
        expect(gitman.lock('gitman_1', 'gitman_3')) == True

        expect(config.__mapper__.text) == CONFIG + strip("""
        sources_locked:
        - name: gitman_1
          type: git
          repo: https://github.com/jacebrowning/gitman-demo
          sparse_paths:
          -
          rev: 1de84ca1d315f81b035cd7b0ecf87ca2025cdacd
          link:
          scripts:
          -
        - name: gitman_3
          type: git
          repo: https://github.com/jacebrowning/gitman-demo
          sparse_paths:
          -
          rev: 9bf18e16b956041f0267c21baad555a23237b52e
          link:
          scripts:
          -
        groups: []
        """) == config.__mapper__.text
Example #6
0
    def it_records_all_versions_when_no_arguments(config):
        expect(gitman.update(depth=1, lock=False)) == True
        expect(gitman.lock()) == True

        config.datafile.load()
        expect(config.datafile.text).contains(
            strip("""
        sources_locked:
          - name: gitman_1
            type: git
            repo: https://github.com/jacebrowning/gitman-demo
            sparse_paths:
              -
            rev: 1de84ca1d315f81b035cd7b0ecf87ca2025cdacd
            link:
            scripts:
              -
          - name: gitman_2
            type: git
            repo: https://github.com/jacebrowning/gitman-demo
            sparse_paths:
              -
            rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04
            link:
            scripts:
              -
          - name: gitman_3
            type: git
            repo: https://github.com/jacebrowning/gitman-demo
            sparse_paths:
              -
            rev: 9bf18e16b956041f0267c21baad555a23237b52e
            link:
            scripts:
              -
        """))