<commit_before>import os
import subprocess
import time
from subprocess import Popen
import pytest
import requests

@pytest.fixture(scope="session")
def augur_db_routes():
    process = subprocess.Popen(['make', 'backend-restart'])
    time.sleep(5) #allow some time for the server to start
    return process



def test_downloaded_repos(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repos')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1

def test_repo_groups(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1

def test_repos_in_repo_groups(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1

def test_get_repo_for_dosocs(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/dosocs/repos')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1

#####################################
###           EVOLUTION           ###
#####################################

def test_code_changes_by_group(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/23/code-changes')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1
    assert data[0]['commit_count'] > 0

def test_code_changes_by_repo(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/23/repos/21350/code-changes')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1
    assert data[0]['commit_count'] > 0

def test_code_changes_lines_by_group(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/23/code-changes-lines')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1
    assert data[0]['added'] >= 0
    assert data[0]['removed'] >= 0

def test_code_changes_lines_by_repo(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/23/repos/21350/code-changes-lines')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1
    assert data[0]['added'] >= 0
    assert data[0]['removed'] >= 0

def test_issues_new_by_group(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/23/issues-new')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1
    assert data[0]['issues'] > 0

def test_issues_new_by_repo(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/20/repos/21000/issues-new')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1
    assert data[0]['issues'] > 0

def test_issues_active_by_group(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/20/issues-active')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1
    assert data[0]['issues'] > 0

def test_issues_active_by_repo(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/23/repos/21000/issues-active')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1
    assert data[0]['issues'] > 0

def test_issues_closed_by_group(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/24/issues-closed')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1
    assert data[0]['issues'] > 0

def test_issues_closed_by_repo(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/24/repos/21681/issues-closed')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1
    assert data[0]['issues'] > 0

def test_issue_duration_by_group(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/20/issue-duration')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1

def test_issue_duration_by_repo(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/20/repos/21009/issue-duration')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1

def test_issue_participants_by_group(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/23/issue-participants')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1
    assert data[0]['participants'] > 0

def test_issue_participants_by_repo(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/23/repos/21403/issue-participants')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1
    assert data[0]['participants'] > 0

def test_issue_throughput_by_group(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/20/issue-throughput')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1
    assert data[0]['throughput'] >= 0

def test_issue_throughput_by_repo(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/24/repos/21682/issue-throughput')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1
    assert data[0]['throughput'] >= 0

def test_issue_backlog_by_group(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/23/issue-backlog')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1
    assert data[0]['issue_backlog'] > 0

def test_issue_backlog_by_repo(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/23/repos/21403/issue-backlog')
    data = response.json()
    assert response.status_code == 200<commit_msg>correcting the rails/rails group id in tests.<commit_after>import os
import subprocess
import time
from subprocess import Popen
import pytest
import requests

@pytest.fixture(scope="session")
def augur_db_routes():
    process = subprocess.Popen(['make', 'backend-restart'])
    time.sleep(5) #allow some time for the server to start
    return process



def test_downloaded_repos(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repos')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1

def test_repo_groups(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1

def test_repos_in_repo_groups(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1

def test_get_repo_for_dosocs(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/dosocs/repos')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1

#####################################
###           EVOLUTION           ###
#####################################

def test_code_changes_by_group(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/20/code-changes')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1
    assert data[0]['commit_count'] > 0

def test_code_changes_by_repo(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/20/repos/21000/code-changes')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1
    assert data[0]['commit_count'] > 0

def test_code_changes_lines_by_group(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/20/code-changes-lines')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1
    assert data[0]['added'] >= 0
    assert data[0]['removed'] >= 0

def test_code_changes_lines_by_repo(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/20/repos/21000/code-changes-lines')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1
    assert data[0]['added'] >= 0
    assert data[0]['removed'] >= 0

def test_issues_new_by_group(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/20/issues-new')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1
    assert data[0]['issues'] > 0

def test_issues_new_by_repo(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/20/repos/21000/issues-new')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1
    assert data[0]['issues'] > 0

def test_issues_active_by_group(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/20/issues-active')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1
    assert data[0]['issues'] > 0

def test_issues_active_by_repo(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/20/repos/21000/issues-active')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1
    assert data[0]['issues'] > 0

def test_issues_closed_by_group(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/24/issues-closed')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1
    assert data[0]['issues'] > 0

def test_issues_closed_by_repo(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/24/repos/21681/issues-closed')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1
    assert data[0]['issues'] > 0

def test_issue_duration_by_group(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/20/issue-duration')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1

def test_issue_duration_by_repo(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/20/repos/21009/issue-duration')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1

def test_issue_participants_by_group(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/20/issue-participants')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1
    assert data[0]['participants'] > 0

def test_issue_participants_by_repo(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/20/repos/21000/issue-participants')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1
    assert data[0]['participants'] > 0

def test_issue_throughput_by_group(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/20/issue-throughput')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1
    assert data[0]['throughput'] >= 0

def test_issue_throughput_by_repo(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/24/repos/21682/issue-throughput')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1
    assert data[0]['throughput'] >= 0

def test_issue_backlog_by_group(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/20/issue-backlog')
    data = response.json()
    assert response.status_code == 200
    assert len(data) >= 1
    assert data[0]['issue_backlog'] > 0

def test_issue_backlog_by_repo(augur_db_routes):
    response = requests.get('http://localhost:5000/api/unstable/repo-groups/20/repos/21403/issue-backlog')
    data = response.json()
    assert response.status_code == 200
{'fraction_non_alphanumeric': 0.14573103120544909, 'fraction_numerical': 0.046095358783462693, 'mean_word_length': 4.23724595603484, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 79, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3132417', 'n_tokens_mistral': 4506, 'n_tokens_neox': 4011, 'n_words': 693}