Ejemplo n.º 1
0
 def setup_method(self, method):
     super(TestTravisMerge, self).setup_method(method)
     self.scc_parser, self.sub_parser = parsers()
     self.command = TravisMerge(self.sub_parser)
     self.base = 'master'
     self.filters = get_default_filters("none")
     self.filters.update({'base': self.base})
Ejemplo n.º 2
0
class UnitTestTravisMerge(MockTest):

    def setUp(self):
        MockTest.setUp(self)

        self.scc_parser, self.sub_parser = parsers()
        self.command = TravisMerge(self.sub_parser)
        self.base = 'master'
        self.filters = self.get_default_filters()

    def get_default_filters(self):
        include_default = {'pr': None, 'user': None, 'label': None}
        exclude_default = {'pr': None, 'user': None, 'label': None}
        return {'base': self.base, 'default': 'none',
                'include': include_default, 'exclude': exclude_default}

    def parse_dependencies(self, comments):
        self.command._parse_dependencies(self.base, comments)

    # Default arguments
    def testDefaults(self):
        self.parse_dependencies([])
        self.assertEqual(self.command.filters, self.filters)

    def testBase(self):
        self.base = 'develop'
        self.filters = self.get_default_filters()  # Regenerate default
        self.parse_dependencies([])
        self.assertEqual(self.command.filters, self.filters)

    def testIncludePRNoHash(self):
        # --depends-on 21 does not change filters
        self.parse_dependencies(['21'])
        self.assertEqual(self.command.filters, self.filters)

    def testIncludeSinglePR(self):
        # --depends-on #21 changes filters
        self.parse_dependencies(['#21'])
        self.filters["include"]["pr"] = ['21']
        self.assertEqual(self.command.filters, self.filters)

    def testIncludeSubmodulePR(self):
        # --depends-on ome/scripts#21 changes filters
        self.parse_dependencies(['ome/scripts#21'])
        self.filters["include"]["pr"] = ['ome/scripts21']
        self.assertEqual(self.command.filters, self.filters)

    def testIncludeMultiplePRs(self):
        # --depends-on #21 changes filters
        self.parse_dependencies(['#21', '#22', 'ome/scripts#21'])
        self.filters["include"]["pr"] = ['21', '22', 'ome/scripts21']
        self.assertEqual(self.command.filters, self.filters)
Ejemplo n.º 3
0
class UnitTestTravisMerge(MockTest):
    def setUp(self):
        MockTest.setUp(self)

        self.scc_parser, self.sub_parser = parsers()
        self.command = TravisMerge(self.sub_parser)
        self.base = "master"
        self.filters = self.get_default_filters()

    def get_default_filters(self):
        include_default = {"pr": None, "user": None, "label": None}
        exclude_default = {"pr": None, "user": None, "label": None}
        return {"base": self.base, "default": "none", "include": include_default, "exclude": exclude_default}

    def parse_dependencies(self, comments):
        self.command._parse_dependencies(self.base, comments)

    # Default arguments
    def testDefaults(self):
        self.parse_dependencies([])
        self.assertEqual(self.command.filters, self.filters)

    def testBase(self):
        self.base = "develop"
        self.filters = self.get_default_filters()  # Regenerate default
        self.parse_dependencies([])
        self.assertEqual(self.command.filters, self.filters)

    def testIncludePRNoHash(self):
        # --depends-on 21 does not change filters
        self.parse_dependencies(["21"])
        self.assertEqual(self.command.filters, self.filters)

    def testIncludeSinglePR(self):
        # --depends-on #21 changes filters
        self.parse_dependencies(["#21"])
        self.filters["include"]["pr"] = ["21"]
        self.assertEqual(self.command.filters, self.filters)

    def testIncludeSubmodulePR(self):
        # --depends-on ome/scripts#21 changes filters
        self.parse_dependencies(["ome/scripts#21"])
        self.filters["include"]["pr"] = ["ome/scripts21"]
        self.assertEqual(self.command.filters, self.filters)

    def testIncludeMultiplePRs(self):
        # --depends-on #21 changes filters
        self.parse_dependencies(["#21", "#22", "ome/scripts#21"])
        self.filters["include"]["pr"] = ["21", "22", "ome/scripts21"]
        self.assertEqual(self.command.filters, self.filters)
Ejemplo n.º 4
0
    def setUp(self):
        MockTest.setUp(self)

        self.scc_parser, self.sub_parser = parsers()
        self.command = TravisMerge(self.sub_parser)
        self.base = 'master'
        self.filters = self.get_default_filters()
Ejemplo n.º 5
0
class TestTravisMerge(MoxTestBase):

    def setup_method(self, method):
        super(TestTravisMerge, self).setup_method(method)
        self.scc_parser, self.sub_parser = parsers()
        self.command = TravisMerge(self.sub_parser)
        self.base = 'master'
        self.filters = get_default_filters("none")
        self.filters.update({'base': self.base})

    def parse_dependencies(self, comments):
        self.command._parse_dependencies(self.base, comments)

    # Default arguments
    def testDefaults(self):
        self.parse_dependencies([])
        assert self.command.filters == self.filters

    def testBase(self):
        self.base = 'develop'
        self.filters['base'] = 'develop'  # Regenerate default
        self.parse_dependencies([])
        assert self.command.filters == self.filters

    def testIncludePRNoHash(self):
        # --depends-on 21 does not change filters
        self.parse_dependencies(['21'])
        assert self.command.filters == self.filters

    def testIncludeSinglePR(self):
        # --depends-on #21 changes filters
        self.parse_dependencies(['#21'])
        self.filters["include"]["pr"] = ['#21']
        assert self.command.filters == self.filters

    def testIncludeSubmodulePR(self):
        # --depends-on ome/scripts#21 changes filters
        self.parse_dependencies(['ome/scripts#21'])
        self.filters["include"]["ome/scripts"] = ['#21']
        assert self.command.filters == self.filters

    def testIncludeMultiplePRs(self):
        # --depends-on #21 changes filters
        self.parse_dependencies(['#21', '#22', 'ome/scripts#21'])
        self.filters["include"]["pr"] = ['#21', '#22']
        self.filters["include"]['ome/scripts'] = ['#21']
        assert self.command.filters == self.filters