Example #1
0
def test_find_project_replacing_dots_with_dashes(project_repository: DBProjectRepository, project_view: DBProjectView):
    project = ProjectStub.create(name=ProjectName('pepy-rocks'))
    project_repository.save_projects([project])

    result = project_view.find('pepy.rocks')
    expected = ProjectProjection('pepy-rocks', project.downloads.value, [])
    assert result == expected
Example #2
0
def test_find_project_ignoring_white_spaces(project_repository: DBProjectRepository, project_view: DBProjectView):
    project = ProjectStub.create(name=ProjectName('pepy'))
    project_repository.save_projects([project])

    result = project_view.find('    pepy  ')
    expected = ProjectProjection('pepy', project.downloads.value, [])
    assert result == expected
Example #3
0
def test_update_downloads(project_repository: DBProjectRepository):
    project = ProjectStub.create()
    project_repository.save_projects([project])
    project_downloads = ProjectDownloadsStub.create(name=project.name)
    project_repository.update_downloads([project_downloads])
    result = find_project(project.name.name)
    assert project_downloads.downloads.value + project.downloads.value == result["downloads"]
Example #4
0
def test_find_project(project_repository: DBProjectRepository):
    project = ProjectStub.create()
    project_repository.save_projects([project])
    result = project_repository.find(project.name)
    assert isinstance(result, Project)
    assert project.name.name == result.name.name
    assert project.downloads.value == result.downloads.value
Example #5
0
def test_find_project_ignoring_case(project_repository: DBProjectRepository, project_view: DBProjectView):
    project = ProjectStub.create(name=ProjectName("pepy"))
    project_repository.save_projects([project])

    result = project_view.find("PEpy")
    expected = ProjectProjection("pepy", project.downloads.value, [])
    assert result == expected
Example #6
0
def test_retrieve_last_downloads(project_repository: DBProjectRepository):
    project = ProjectStub.create()
    project_repository.save_projects([project])
    project_downloads = ProjectDownloadsStub.create_consecutive(project.name)
    project_repository.save_day_downloads(project_downloads)
    assert project_downloads == project_repository.last_downloads(project.name)