def test_set_origin(self, mock_shell):
        options = Values()

        git_show = """
            * remote origin
              Fetch URL: [email protected]:pulp/pulp_puppet.git
              Push  URL: [email protected]:pulp/pulp_puppet.git
              HEAD branch: (not queried)
              Remote branches: (status not queried)
                branch_1
              Local branches configured for 'git pull':
                branch_2
              Local ref configured for 'git push' (status not queried):
                (matching) pushes to (matching)
            """

        mock_shell.side_effect = [
            (0, None),
            (0, git_show)
        ]

        # test

        builder.set_origin(options)

        # validation

        mock_shell.assert_any_call('git status', False)
        mock_shell.assert_any_call('git remote show -n origin')

        self.assertEqual(options.origin, '[email protected]:pulp/pulp_puppet.git')
    def test_set_origin(self, mock_shell):
        options = Values()

        git_show = """
            * remote origin
              Fetch URL: [email protected]:pulp/pulp_puppet.git
              Push  URL: [email protected]:pulp/pulp_puppet.git
              HEAD branch: (not queried)
              Remote branches: (status not queried)
                branch_1
              Local branches configured for 'git pull':
                branch_2
              Local ref configured for 'git push' (status not queried):
                (matching) pushes to (matching)
            """

        mock_shell.side_effect = [
            (0, None),
            (0, git_show)
        ]

        # test

        builder.set_origin(options)

        # validation

        mock_shell.assert_any_call('git status', False)
        mock_shell.assert_any_call('git remote show -n origin')

        self.assertEqual(options.origin, '[email protected]:pulp/pulp_puppet.git')
    def test_set_origin_outside_repository(self, mock_shell):
        options = Values()
        mock_shell.return_value = (1, None)

        # test

        builder.set_origin(options)

        # validation

        mock_shell.assert_any_call('git status', False)

        self.assertTrue(options.origin is None)
    def test_set_origin_outside_repository(self, mock_shell):
        options = Values()
        mock_shell.return_value = (1, None)

        # test

        builder.set_origin(options)

        # validation

        mock_shell.assert_any_call('git status', False)

        self.assertTrue(options.origin is None)