Unverified Commit fa2f0119 authored by Peter Stanko's avatar Peter Stanko
Browse files

Fixes in the default gitlab domain

parent e0870072
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -527,7 +527,7 @@ class Project(db.Model, EntityBase, NamedMixin):

    def __init__(self, course: Course, codename: str = None, name: str = None,
                 description: str = None, assignment_url: str = None,
                 submit_configurable: bool = False):
                 submit_configurable: bool = True):
        """Creates instance of the project
        Args:
            course(Course): Course instance
+3 −2
Original line number Diff line number Diff line
@@ -69,9 +69,10 @@ class SubmissionsService(GeneralService):
        updated_params = deepcopy(params)
        gitlab_base = self._config.get("GITLAB_BASE_DOMAIN")
        course_code = project.course.codename
        gitlab_url = f'git@{gitlab_base}:{user.username}/{course_code}.git'
        updated_params['file_params'] = dict(
            from_dir=project.codename,
            source={'type': 'git', 'url': f'git@{gitlab_base}:{user.username}/{course_code}.git'}
            source={'type': 'git', 'url': gitlab_url}
        )
        return updated_params

@@ -217,7 +218,7 @@ class SubmissionsService(GeneralService):

    def __get_default_git_url(self, project: Project, user: User):
        git_base = self._config.get('GIT_REPO_BASE', 'git@gitlab.fi.muni.cz')
        return f"{git_base}/{user.username}/{project.course.codename}"
        return f"{git_base}:{user.username}/{project.course.codename}.git"

    def get_stats(self):
        """Gets the statistics for the submission
+1 −1
Original line number Diff line number Diff line
@@ -282,7 +282,7 @@ def test_create_submission_as_with_default_params(client, ent_mocker, rest_servi
    assert submission.course == course
    assert submission.user == user
    assert submission.parameters['file_params']['from_dir'] == project.codename
    gitlab_url = f'git@gitlab.fi.muni.cz:{user.username}/{course.codename}.git'
    gitlab_url = f'git@gitlab.local:{user.username}/{course.codename}.git'
    assert submission.parameters['file_params']['source']['url'] == gitlab_url