コード例 #1
0
    def test_branches(self):
        branches = {'branches': ['master', 'stable']}
        url = 'https://github.com/mezuro/kalibro_client_py.git'
        scm_type = 'GIT'

        with patch.object(Repository, 'request',
                          return_value=branches) as repository_request:
            Repository.branches(url, scm_type)
            repository_request.assert_called_once_with("/branches", {'url': url, 'scm_type': scm_type})
コード例 #2
0
 def history_of(cls, metric_name, kalibro_module_id, repository_id):
     response = Repository.request(
         action=":id/metric_result_history_of",
         params={"metric_name": metric_name, "kalibro_module_id": kalibro_module_id, "id": repository_id},
     )["metric_result_history_of"]
     return [
         kalibro_client.miscellaneous.date_metric_result.DateMetricResult(**date_metric_result_hash)
         for date_metric_result_hash in response
     ]
コード例 #3
0
 def test_repositories_of(self):
     response = {"repositories": [self.subject._asdict()]}
     with patch.object(Repository, 'request', return_value=response) as request_mock, \
         patch.object(Repository, 'response_to_objects_array', return_value=[self.subject]) as response_to_array_mock:
         repositories = Repository.repositories_of(self.subject.project_id)
         request_mock.assert_called_once_with(
             action='',
             params={'id': self.subject.project_id},
             method='get',
             prefix='projects/:id')
         response_to_array_mock.assert_called_once_with(response)
         assert_equal(repositories, [self.subject])
コード例 #4
0
 def history_of(cls, module_result, repository_id):
     response = Repository.request(action=':id/module_result_history_of',
                                   params={'id': repository_id, 'kalibro_module_id': module_result.kalibro_module.id})['module_result_history_of']
     return [kalibro_client.miscellaneous.date_module_result.DateModuleResult(element[0], element[1]) for element in response]
コード例 #5
0
 def fetch_data(self):
     for repository in Repository.all():
         mezuro_repo = self.get_plugin_model_instance(MezuroRepository,
                                                      repository)
         mezuro_repo.save()
コード例 #6
0
def step_impl(context):
    context.repository_types = Repository.repository_types()
コード例 #7
0
def step_impl(context):
    context.repositories = Repository.all()
コード例 #8
0
def step_impl(context):
    assert_true(not Repository.exists(context.repository.id))
コード例 #9
0
def step_impl(context):
    context.project_repositories = Repository.repositories_of(context.project.id)
コード例 #10
0
def step_impl(context):
    context.found_repository = Repository.find(context.repository.id)
コード例 #11
0
def step_impl(context):
    context.response = Repository.exists(context.repository.id)
import datetime

from kalibro_client.processor import Repository

repository = Repository()
repository.id = 1
repository.name = 'repository name'
repository.scm_type = 'github'
repository.address = 'https://github.com/repository-name'
repository.description = 'repository description'
repository.license = 'license'
repository.period = 1
repository.created_at = datetime.datetime(2015, 9, 7, 18, 20, 18, 888000)
repository.updated_at = datetime.datetime(2015, 9, 7, 18, 20, 18, 888000)
repository.branch = 'master'

repositories = [repository]