Example #1
0
def test_clone_and_create(get_dst_path, gm_mock):
    url = 'http://some.url/fake'
    get_dst_path.return_value = 'fake'
    result = clone_and_create_repo.delay(url)
    gm_mock.assert_called_with(url, 'fake')
    repo = Repository.objects.get(id=result.result)
    assert url == repo.url
Example #2
0
def test_clone_and_create_removes_git_extension_from_folder(gm_mock):
    url = 'http://some.url/fake.git'
    clone_and_create_repo.delay(url)
    path = os.path.join(settings.RAFEE_REPO_DIR, 'fake')
    gm_mock.assert_called_with(url, path)
Example #3
0
 def create(self, request, *args, **kwargs):
     serializer = self.get_serializer(data=request.data)
     serializer.is_valid(raise_exception=True)
     task = clone_and_create_repo.delay(request.data['url'])
     return Response({'task': task.task_id})
Example #4
0
def test_task_includes_error(gm_mock):
    error = IOError('Cannot clone there')
    gm_mock.side_effect = error
    result = clone_and_create_repo.delay('http://some.url/fake')
    assert error == result.result
    assert states.FAILURE == result.status
Example #5
0
    try:
        team = Team.objects.get(name=name)
        teams.append(team)
    except Team.DoesNotExist:
        teams.append(TeamFactory(name=name))

print 'Teams: ', teams

admin = UserFactory(is_staff=True)
user1 = UserFactory(teams=(teams[0],))
user2 = UserFactory(teams=teams)
UserFactory(teams=teams)
UserFactory(teams=teams)

repo_urls = [
    'https://github.com/holandes22/hsg-templates.git',
    'https://github.com/holandes22/css-templates.git',
]

for repo_url in repo_urls:
    print 'Cloning {}'.format(repo_url)
    task = clone_and_create_repo.delay(repo_url)
    result = task.get()

templates1 = 'hsg-templates/commits,css-templates/users'
slideshow1 = SlideshowFactory(templates=templates1, team=teams[0])

templates2 = 'css-templates/user_repos,css-templates/users,css-templates/no_data'
slideshow1 = SlideshowFactory(templates=templates2, team=teams[1])
print 'Done'