Esempio n. 1
0
    def fetch_all_mine_with_permissions(self):
        prj1, prj2 = INFO, dict(INFO, id=678)

        api = self.api
        api.collect_all_pages = Mock(return_value=[prj1, prj2])
        api.version = Mock(return_value=Version.parse("11.0.0-ee"))

        result = Project.fetch_all_mine(api)
        api.collect_all_pages.assert_called_once_with(GET(
            '/projects',
            {
                'membership': True,
                'with_merge_requests_enabled': True,
            },
        ))
        assert [prj.info for prj in result] == [prj1, prj2]
        assert all(prj.access_level == AccessLevel.developer for prj in result)
Esempio n. 2
0
    def test_fetch_from_merge_request_ce_compat(self):
        api = self.api
        api.version = Mock(return_value=Version.parse('9.2.3'))
        api.call = Mock()

        merge_request = MergeRequest(api, {
            'id': 74,
            'iid': 6,
            'project_id': 1234
        })
        approvals = merge_request.fetch_approvals()

        api.call.assert_not_called()
        assert approvals.info == {
            'id': 74,
            'iid': 6,
            'project_id': 1234,
            'approvals_left': 0,
            'approved_by': [],
        }
Esempio n. 3
0
 def setup_method(self, _method):
     self.api = Mock(Api)
     self.api.version = Mock(return_value=Version.parse('9.2.3-ee'))
     self.merge_request = MergeRequest(api=self.api, info=INFO)
Esempio n. 4
0
 def setup_method(self, _method):
     self.api = Mock(Api)
     self.api.version = Mock(return_value=Version.parse('9.2.3-ee'))
     self.approvals = Approvals(api=self.api, info=INFO)