Exemple #1
0
    def check_allowed_origins(self, commit):
        """Check if the origin is allowed.

        Return True on success, False on failure."""
        if not utils.is_origin_allowed(commit['origin'], self.config['general']['allowed_origins']):
            self.log.warning('Commit {id} does not match any allowed origins (origin: {origin}).'.format(**commit))
            return False

        self.log.info('Commit {id} matches allowed origin: {origin}.'.format(**commit))
        return True
Exemple #2
0
 def test_partial_origin(self):
     self.assertFalse(utils.is_origin_allowed('mast',
         self.allowed_origins))
Exemple #3
0
 def test_empty_origin(self):
     self.assertFalse(utils.is_origin_allowed('',
         self.allowed_origins))
Exemple #4
0
 def test_very_short_allowed_origin(self):
     self.assertFalse(utils.is_origin_allowed('x/no',
         self.allowed_origins))
Exemple #5
0
 def test_nested_without_match_on_first_level(self):
     self.assertFalse(utils.is_origin_allowed('feature/blub',
         self.allowed_origins))
Exemple #6
0
 def test_nested_with_match_in_subgroup(self):
     self.assertTrue(utils.is_origin_allowed('feature/foo/bar',
         self.allowed_origins))
Exemple #7
0
 def test_nested_with_single_origin_in_group(self):
     self.assertTrue(utils.is_origin_allowed('feature/foo',
         self.allowed_origins))
Exemple #8
0
 def test_origin_nested(self):
     self.assertTrue(utils.is_origin_allowed('bugfix/1/2/3',
         self.allowed_origins))
Exemple #9
0
 def test_origin_same_as_group(self):
     self.assertFalse(utils.is_origin_allowed('bugfix',
         self.allowed_origins))
Exemple #10
0
 def test_origin_in_group(self):
     self.assertTrue(utils.is_origin_allowed('bugfix/id2',
         self.allowed_origins))
Exemple #11
0
 def test_origin_allowed(self):
     self.assertTrue(utils.is_origin_allowed('master',
         self.allowed_origins))