
* supersede command allows the marking of commits as superceded by a set of upstream changes * drop command allows the marking of commits that should be dropped Both commands add git notes to a given sha1 in the upstream-merge namespace (refs/notes/upstream-merge). The notes are read by the import-upstream command during import and the appropriate actions are then taken. Add functional and unit tests for the two newly created commands. JIRA: CICD-248 Change-Id: I6f69dd890af18e77a9affdb958afde1ec8b1cab8
32 lines
1.1 KiB
Python
32 lines
1.1 KiB
Python
#
|
|
# Copyright (c) 2012, 2013 Hewlett-Packard Development Company, L.P.
|
|
#
|
|
# Confidential computer software. Valid license from HP required for
|
|
# possession, use or copying. Consistent with FAR 12.211 and 12.212,
|
|
# Commercial Computer Software, Computer Software Documentation, and
|
|
# Technical Data for Commercial Items are licensed to the U.S. Government
|
|
# under vendor's standard commercial license.
|
|
#
|
|
|
|
"""Tests for the 'commands' module"""
|
|
|
|
import testtools
|
|
from argparse import ArgumentParser
|
|
|
|
from ghp import commands as c
|
|
|
|
class TestGetSubcommands(testtools.TestCase):
|
|
"""Test case for get_subcommands function"""
|
|
|
|
_available_subcommands = ('import-upstream', 'supersede' ,'drop')
|
|
|
|
def test_available_subcommands(self):
|
|
"""Test available subcommands"""
|
|
parser = ArgumentParser()
|
|
subparsers = parser.add_subparsers()
|
|
subcommands = c.get_subcommands(subparsers)
|
|
self.assertEqual(len(TestGetSubcommands._available_subcommands),
|
|
len(subcommands.keys()))
|
|
for command in subcommands.keys():
|
|
self.assertIn(command, TestGetSubcommands._available_subcommands)
|