diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 53c7dfe67db..0e8931d7613 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,3 +1,3 @@ # WARNING: Do not edit this file manually! Edit ci/spec.yml and run ci/regen-workflow.py. -{"name": "CI", "on": ["push", "pull_request"], "defaults": {"run": {"shell": "bash"}}, "env": {"PRODUCTION": "TRUE"}, "jobs": {"linting": {"runs-on": "ubuntu-latest", "strategy": {"matrix": {"python-version": [3.7, 3.8]}, "fail-fast": false}, "steps": [{"name": "Set up repo", "uses": "actions/checkout@v2"}, {"name": "Set up Python ${{ matrix.python-version }}", "uses": "actions/setup-python@v2", "with": {"python-version": "${{ matrix.python-version }}"}}, {"name": "Set up pip cache", "uses": "actions/cache@v2", "with": {"path": "~/.cache/pip", "key": "pip-${{ matrix.python-version }}"}}, {"name": "Set up venv", "run": "set -e\n\npip install -U virtualenv\nvirtualenv venv\n\nsource venv/bin/activate\n\npip install -U pip setuptools\npip install -U \\\n flake8 pylint pylint-django pylint-plugin-utils isort~=4.3 black==20.8b1 autopep8 \\\n coverage coveralls pyyaml\npip install -U -r requirements.txt\n\necho \"PATH=$PATH\" >> $GITHUB_ENV\necho \"VIRTUAL_ENV=$VIRTUAL_ENV\" >> $GITHUB_ENV\n"}, {"name": "Copy secret.py", "run": "cp intranet/settings/ci_secret.py intranet/settings/secret.py"}, {"name": "Run flake8", "run": "flake8 --max-line-length 150 --exclude=*/migrations/* intranet/ scripts/ docs/ *.py"}, {"name": "Run pylint", "run": "pylint --jobs=0 --disable=fixme,broad-except,global-statement,attribute-defined-outside-init,cyclic-import --django-settings-module=intranet.settings intranet/"}, {"name": "Run isort", "run": "isort --check --recursive intranet"}]}, "formatting": {"runs-on": "ubuntu-latest", "strategy": {"matrix": {"python-version": [3.7, 3.8]}, "fail-fast": false}, "steps": [{"name": "Set up repo", "uses": "actions/checkout@v2"}, {"name": "Set up Python ${{ matrix.python-version }}", "uses": "actions/setup-python@v2", "with": {"python-version": "${{ matrix.python-version }}"}}, {"name": "Set up pip cache", "uses": "actions/cache@v2", "with": {"path": "~/.cache/pip", "key": "pip-${{ matrix.python-version }}"}}, {"name": "Set up venv", "run": "set -e\n\npip install -U virtualenv\nvirtualenv venv\n\nsource venv/bin/activate\n\npip install -U pip setuptools\npip install -U \\\n flake8 pylint pylint-django pylint-plugin-utils isort~=4.3 black==20.8b1 autopep8 \\\n coverage coveralls pyyaml\npip install -U -r requirements.txt\n\necho \"PATH=$PATH\" >> $GITHUB_ENV\necho \"VIRTUAL_ENV=$VIRTUAL_ENV\" >> $GITHUB_ENV\n"}, {"name": "Copy secret.py", "run": "cp intranet/settings/ci_secret.py intranet/settings/secret.py"}, {"name": "Format code", "run": "./scripts/build_ensure_no_changes.sh ./scripts/format.sh"}, {"name": "Format static files and templates", "run": "./scripts/build_ensure_no_changes.sh ./scripts/static_templates_format.sh"}]}, "build": {"runs-on": "ubuntu-latest", "strategy": {"matrix": {"python-version": [3.7, 3.8]}, "fail-fast": false}, "steps": [{"name": "Set up repo (fetching all commits)", "uses": "actions/checkout@v2", "with": {"fetch-depth": 0}}, {"name": "Set up Python ${{ matrix.python-version }}", "uses": "actions/setup-python@v2", "with": {"python-version": "${{ matrix.python-version }}"}}, {"name": "Set up pip cache", "uses": "actions/cache@v2", "with": {"path": "~/.cache/pip", "key": "pip-${{ matrix.python-version }}"}}, {"name": "Set up venv", "run": "set -e\n\npip install -U virtualenv\nvirtualenv venv\n\nsource venv/bin/activate\n\npip install -U pip setuptools\npip install -U \\\n flake8 pylint pylint-django pylint-plugin-utils isort~=4.3 black==20.8b1 autopep8 \\\n coverage coveralls pyyaml\npip install -U -r requirements.txt\n\necho \"PATH=$PATH\" >> $GITHUB_ENV\necho \"VIRTUAL_ENV=$VIRTUAL_ENV\" >> $GITHUB_ENV\n"}, {"name": "Copy secret.py", "run": "cp intranet/settings/ci_secret.py intranet/settings/secret.py"}, {"name": "Regenerate workflow YAML file and check for changes", "run": "set -e\npip install pyyaml\n./scripts/build_ensure_no_changes.sh ./ci/regen-workflow.py\n"}, {"name": "Build docs", "run": "./scripts/build_ensure_no_changes.sh ./scripts/build_docs.sh"}, {"name": "Build sources", "run": "./scripts/build_ensure_no_changes.sh ./scripts/build_sources.sh"}, {"name": "Check for chenges to CI spec", "run": "./scripts/build_ensure_no_changes.sh ./ci/regen-workflow.py"}, {"name": "Check for unmigrated changes", "run": "./scripts/build_ensure_no_changes.sh ./manage.py migrate"}, {"name": "Validate PR commit messages", "if": "github.event_name == 'pull_request'", "run": "./scripts/validate-commit-messages.py ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}"}, {"name": "Validate push commit messages", "if": "github.event_name == 'push' && (github.repository_owner != 'tjcsl' || github.ref != 'refs/heads/master' || github.ref != 'refs/heads/dev')", "run": "git fetch origin ${{ github.event.before }} && ./scripts/validate-commit-messages.py ${{ github.event.before }}..${{ github.event.after }}"}, {"name": "Push docs", "if": "github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository_owner == 'tjcsl' && matrix.python-version == 3.8", "run": "./scripts/push_docs.sh", "env": {"GH_TOKEN": "${{ secrets.DOCS_GH_TOKEN }}"}}]}, "tests": {"runs-on": "ubuntu-latest", "strategy": {"matrix": {"python-version": [3.7, 3.8], "node-version": ["12.x"]}, "fail-fast": false}, "services": {"rabbitmq": {"image": "rabbitmq:latest", "ports": ["5672:5672"], "options": "--health-cmd \"rabbitmqctl node_health_check\" --health-interval 6s --health-timeout 5s --health-retries 10"}, "redis": {"image": "redis:latest", "ports": ["6379:6379"], "options": "--entrypoint redis-server"}, "postgres": {"image": "postgres:latest", "env": {"POSTGRES_USER": "postgres", "POSTGRES_PASSWORD": "postgres", "POSTGRES_DB": "postgres"}, "ports": ["5432:5432"], "options": "--health-cmd pg_isready --health-interval 6s --health-timeout 5s --health-retries 9"}}, "steps": [{"name": "Set up repo", "uses": "actions/checkout@v2"}, {"name": "Set up Python ${{ matrix.python-version }}", "uses": "actions/setup-python@v2", "with": {"python-version": "${{ matrix.python-version }}"}}, {"name": "Set up pip cache", "uses": "actions/cache@v2", "with": {"path": "~/.cache/pip", "key": "pip-${{ matrix.python-version }}"}}, {"name": "Set up venv", "run": "set -e\n\npip install -U virtualenv\nvirtualenv venv\n\nsource venv/bin/activate\n\npip install -U pip setuptools\npip install -U \\\n flake8 pylint pylint-django pylint-plugin-utils isort~=4.3 black==20.8b1 autopep8 \\\n coverage coveralls pyyaml\npip install -U -r requirements.txt\n\necho \"PATH=$PATH\" >> $GITHUB_ENV\necho \"VIRTUAL_ENV=$VIRTUAL_ENV\" >> $GITHUB_ENV\n"}, {"name": "Copy secret.py", "run": "cp intranet/settings/ci_secret.py intranet/settings/secret.py"}, {"name": "Set up Node.js ${{ matrix.node-version }}", "uses": "actions/setup-node@v1", "with": {"node-version": "${{ matrix.node-version }}"}}, {"name": "Install Sass and add Node modules bin to PATH", "run": "set -e\nnpm install sass\necho \"PATH=${{ github.workspace }}/node_modules/.bin:$PATH\" >> $GITHUB_ENV\n"}, {"name": "Set and create PGPASSFILE", "run": "set -e\nPGPASSFILE=${{ runner.temp }}/.pgpass\necho \"PGPASSFILE=$PGPASSFILE\" >> $GITHUB_ENV\necho 127.0.0.1:5432:postgres:postgres:postgres >$PGPASSFILE\nchmod 600 $PGPASSFILE\n"}, {"name": "Create database", "run": "psql -U postgres -h 127.0.0.1 -c 'create database ion'"}, {"name": "install Kerberos", "run": "sudo apt install -y krb5-user"}, {"name": "Run tests", "run": "coverage run ./setup.py test"}, {"name": "Migrate database", "run": "coverage run -a ./manage.py migrate"}, {"name": "Collect static files", "run": "coverage run -a ./manage.py collectstatic --noinput -v 0"}, {"name": "Report coverage to Coveralls", "uses": "AndreMiras/coveralls-python-action@develop", "with": {"parallel": true}}, {"name": "Build coverage XML file", "if": "github.repository_owner == 'tjcsl' && github.event_name != 'pull_request'", "run": "coverage xml"}, {"name": "Report coverage to Codacy", "uses": "codacy/codacy-coverage-reporter-action@master", "if": "github.repository_owner == 'tjcsl' && github.event_name != 'pull_request'", "with": {"coverage-reports": "coverage.xml", "project-token": "${{ secrets.CODACY_PROJECT_TOKEN }}"}}]}, "finish_success": {"needs": ["linting", "formatting", "build", "tests"], "runs-on": "ubuntu-latest", "steps": [{"name": "Tell Coveralls that parallel jobs have finished", "uses": "coverallsapp/github-action@master", "with": {"github-token": "${{ secrets.GITHUB_TOKEN }}", "parallel-finished": true}}]}}} \ No newline at end of file +{"name": "CI", "on": ["push", "pull_request"], "defaults": {"run": {"shell": "bash"}}, "env": {"PRODUCTION": "TRUE"}, "jobs": {"linting": {"runs-on": "ubuntu-latest", "strategy": {"matrix": {"python-version": [3.7, 3.8]}, "fail-fast": false}, "steps": [{"name": "Set up repo", "uses": "actions/checkout@v2"}, {"name": "Set up Python ${{ matrix.python-version }}", "uses": "actions/setup-python@v2", "with": {"python-version": "${{ matrix.python-version }}"}}, {"name": "Set up pip cache", "uses": "actions/cache@v2", "with": {"path": "~/.cache/pip", "key": "pip-${{ matrix.python-version }}"}}, {"name": "Set up venv", "run": "set -e\n\npip install -U virtualenv\nvirtualenv venv\n\nsource venv/bin/activate\n\npip install -U pip setuptools\npip install -U \\\n flake8 pylint pylint-django pylint-plugin-utils isort~=4.3 black==20.8b1 autopep8 \\\n coveralls pyyaml pytest-django\npip install -U -r requirements.txt\n\necho \"PATH=$PATH\" >> $GITHUB_ENV\necho \"VIRTUAL_ENV=$VIRTUAL_ENV\" >> $GITHUB_ENV\n"}, {"name": "Copy secret.py", "run": "cp intranet/settings/ci_secret.py intranet/settings/secret.py"}, {"name": "Run flake8", "run": "flake8 --max-line-length 150 --exclude=*/migrations/* intranet/ scripts/ docs/ *.py"}, {"name": "Run pylint", "run": "pylint --jobs=0 --disable=fixme,broad-except,global-statement,attribute-defined-outside-init,cyclic-import --django-settings-module=intranet.settings intranet/"}, {"name": "Run isort", "run": "isort --check --recursive intranet"}]}, "formatting": {"runs-on": "ubuntu-latest", "strategy": {"matrix": {"python-version": [3.7, 3.8]}, "fail-fast": false}, "steps": [{"name": "Set up repo", "uses": "actions/checkout@v2"}, {"name": "Set up Python ${{ matrix.python-version }}", "uses": "actions/setup-python@v2", "with": {"python-version": "${{ matrix.python-version }}"}}, {"name": "Set up pip cache", "uses": "actions/cache@v2", "with": {"path": "~/.cache/pip", "key": "pip-${{ matrix.python-version }}"}}, {"name": "Set up venv", "run": "set -e\n\npip install -U virtualenv\nvirtualenv venv\n\nsource venv/bin/activate\n\npip install -U pip setuptools\npip install -U \\\n flake8 pylint pylint-django pylint-plugin-utils isort~=4.3 black==20.8b1 autopep8 \\\n coveralls pyyaml pytest-django\npip install -U -r requirements.txt\n\necho \"PATH=$PATH\" >> $GITHUB_ENV\necho \"VIRTUAL_ENV=$VIRTUAL_ENV\" >> $GITHUB_ENV\n"}, {"name": "Copy secret.py", "run": "cp intranet/settings/ci_secret.py intranet/settings/secret.py"}, {"name": "Format code", "run": "./scripts/build_ensure_no_changes.sh ./scripts/format.sh"}, {"name": "Format static files and templates", "run": "./scripts/build_ensure_no_changes.sh ./scripts/static_templates_format.sh"}]}, "build": {"runs-on": "ubuntu-latest", "strategy": {"matrix": {"python-version": [3.7, 3.8]}, "fail-fast": false}, "steps": [{"name": "Set up repo (fetching all commits)", "uses": "actions/checkout@v2", "with": {"fetch-depth": 0}}, {"name": "Set up Python ${{ matrix.python-version }}", "uses": "actions/setup-python@v2", "with": {"python-version": "${{ matrix.python-version }}"}}, {"name": "Set up pip cache", "uses": "actions/cache@v2", "with": {"path": "~/.cache/pip", "key": "pip-${{ matrix.python-version }}"}}, {"name": "Set up venv", "run": "set -e\n\npip install -U virtualenv\nvirtualenv venv\n\nsource venv/bin/activate\n\npip install -U pip setuptools\npip install -U \\\n flake8 pylint pylint-django pylint-plugin-utils isort~=4.3 black==20.8b1 autopep8 \\\n coveralls pyyaml pytest-django\npip install -U -r requirements.txt\n\necho \"PATH=$PATH\" >> $GITHUB_ENV\necho \"VIRTUAL_ENV=$VIRTUAL_ENV\" >> $GITHUB_ENV\n"}, {"name": "Copy secret.py", "run": "cp intranet/settings/ci_secret.py intranet/settings/secret.py"}, {"name": "Regenerate workflow YAML file and check for changes", "run": "./scripts/build_ensure_no_changes.sh ./ci/regen-workflow.py"}, {"name": "Build docs", "run": "./scripts/build_ensure_no_changes.sh ./scripts/build_docs.sh"}, {"name": "Build sources", "run": "./scripts/build_ensure_no_changes.sh ./scripts/build_sources.sh"}, {"name": "Check for chenges to CI spec", "run": "./scripts/build_ensure_no_changes.sh ./ci/regen-workflow.py"}, {"name": "Check for unmigrated changes", "run": "./scripts/build_ensure_no_changes.sh ./manage.py migrate"}, {"name": "Validate PR commit messages", "if": "github.event_name == 'pull_request'", "run": "./scripts/validate-commit-messages.py ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}"}, {"name": "Validate push commit messages", "if": "github.event_name == 'push' && (github.repository_owner != 'tjcsl' || github.ref != 'refs/heads/master' || github.ref != 'refs/heads/dev')", "run": "git fetch origin ${{ github.event.before }} && ./scripts/validate-commit-messages.py ${{ github.event.before }}..${{ github.event.after }}"}, {"name": "Push docs", "if": "github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository_owner == 'tjcsl' && matrix.python-version == 3.8", "run": "./scripts/push_docs.sh", "env": {"GH_TOKEN": "${{ secrets.DOCS_GH_TOKEN }}"}}]}, "tests": {"runs-on": "ubuntu-latest", "strategy": {"matrix": {"python-version": [3.7, 3.8], "node-version": ["12.x"]}, "fail-fast": false}, "services": {"rabbitmq": {"image": "rabbitmq:latest", "ports": ["5672:5672"], "options": "--health-cmd \"rabbitmqctl node_health_check\" --health-interval 6s --health-timeout 5s --health-retries 10"}, "redis": {"image": "redis:latest", "ports": ["6379:6379"], "options": "--entrypoint redis-server"}, "postgres": {"image": "postgres:latest", "env": {"POSTGRES_USER": "postgres", "POSTGRES_PASSWORD": "postgres", "POSTGRES_DB": "postgres"}, "ports": ["5432:5432"], "options": "--health-cmd pg_isready --health-interval 6s --health-timeout 5s --health-retries 9"}}, "steps": [{"name": "Set up repo", "uses": "actions/checkout@v2"}, {"name": "Set up Python ${{ matrix.python-version }}", "uses": "actions/setup-python@v2", "with": {"python-version": "${{ matrix.python-version }}"}}, {"name": "Set up pip cache", "uses": "actions/cache@v2", "with": {"path": "~/.cache/pip", "key": "pip-${{ matrix.python-version }}"}}, {"name": "Set up venv", "run": "set -e\n\npip install -U virtualenv\nvirtualenv venv\n\nsource venv/bin/activate\n\npip install -U pip setuptools\npip install -U \\\n flake8 pylint pylint-django pylint-plugin-utils isort~=4.3 black==20.8b1 autopep8 \\\n coveralls pyyaml pytest-django\npip install -U -r requirements.txt\n\necho \"PATH=$PATH\" >> $GITHUB_ENV\necho \"VIRTUAL_ENV=$VIRTUAL_ENV\" >> $GITHUB_ENV\n"}, {"name": "Copy secret.py", "run": "cp intranet/settings/ci_secret.py intranet/settings/secret.py"}, {"name": "Set up Node.js ${{ matrix.node-version }}", "uses": "actions/setup-node@v1", "with": {"node-version": "${{ matrix.node-version }}"}}, {"name": "Install Sass and add Node modules bin to PATH", "run": "set -e\nnpm install sass\necho \"PATH=${{ github.workspace }}/node_modules/.bin:$PATH\" >> $GITHUB_ENV\n"}, {"name": "Set and create PGPASSFILE", "run": "set -e\nPGPASSFILE=${{ runner.temp }}/.pgpass\necho \"PGPASSFILE=$PGPASSFILE\" >> $GITHUB_ENV\necho 127.0.0.1:5432:postgres:postgres:postgres >$PGPASSFILE\nchmod 600 $PGPASSFILE\n"}, {"name": "Create database", "run": "psql -U postgres -h 127.0.0.1 -c 'create database ion'"}, {"name": "install Kerberos", "run": "sudo apt install -y krb5-user"}, {"name": "Run tests", "run": "coverage run -m pytest"}, {"name": "Migrate database", "run": "coverage run -a ./manage.py migrate"}, {"name": "Collect static files", "run": "coverage run -a ./manage.py collectstatic --noinput -v 0"}, {"name": "Report coverage to Coveralls", "uses": "AndreMiras/coveralls-python-action@develop", "with": {"parallel": true}}, {"name": "Build coverage XML file", "if": "github.repository_owner == 'tjcsl' && github.event_name != 'pull_request'", "run": "coverage xml"}, {"name": "Report coverage to Codacy", "uses": "codacy/codacy-coverage-reporter-action@master", "if": "github.repository_owner == 'tjcsl' && github.event_name != 'pull_request'", "with": {"coverage-reports": "coverage.xml", "project-token": "${{ secrets.CODACY_PROJECT_TOKEN }}"}}]}, "finish_success": {"needs": ["linting", "formatting", "build", "tests"], "runs-on": "ubuntu-latest", "steps": [{"name": "Tell Coveralls that parallel jobs have finished", "uses": "coverallsapp/github-action@master", "with": {"github-token": "${{ secrets.GITHUB_TOKEN }}", "parallel-finished": true}}]}}} \ No newline at end of file diff --git a/Ion.egg-info/SOURCES.txt b/Ion.egg-info/SOURCES.txt index b77683acda4..dbb83455430 100644 --- a/Ion.egg-info/SOURCES.txt +++ b/Ion.egg-info/SOURCES.txt @@ -15,6 +15,7 @@ deploy fabfile.py manage.py pyproject.toml +pytest.ini requirements.txt setup.py .dependabot/config.yml diff --git a/ci/spec.yml b/ci/spec.yml index c02e365ad55..ced33fa6b5b 100644 --- a/ci/spec.yml +++ b/ci/spec.yml @@ -64,7 +64,7 @@ env: pip install -U pip setuptools pip install -U \ flake8 pylint pylint-django pylint-plugin-utils isort~=4.3 black==20.8b1 autopep8 \ - coverage coveralls pyyaml + coveralls pyyaml pytest-django pip install -U -r requirements.txt echo "PATH=$PATH" >> $GITHUB_ENV @@ -134,10 +134,7 @@ jobs: - *copy_secret - name: Regenerate workflow YAML file and check for changes - run: | - set -e - pip install pyyaml - ./scripts/build_ensure_no_changes.sh ./ci/regen-workflow.py + run: ./scripts/build_ensure_no_changes.sh ./ci/regen-workflow.py # Build docs/sources - name: Build docs @@ -239,7 +236,7 @@ jobs: # Tests - name: Run tests - run: coverage run ./setup.py test + run: coverage run -m pytest - name: Migrate database run: coverage run -a ./manage.py migrate - name: Collect static files diff --git a/intranet/apps/api/tests.py b/intranet/apps/api/tests.py index 96e294607fe..7fedbbdb3bf 100644 --- a/intranet/apps/api/tests.py +++ b/intranet/apps/api/tests.py @@ -507,7 +507,7 @@ def test_api_eighth_signup_list(self): def test_api_bus_list(self): self.make_token() - route = Route.objects.create(route_name="JT-001", bus_number="JT-001") + route = Route.objects.create(route_name="JT-01", bus_number="JT-01") response = self.client.get(reverse("api_bus_list"), HTTP_AUTHORIZATION=self.auth) self.assertEqual(response.status_code, 200) @@ -517,7 +517,7 @@ def test_api_bus_list(self): def test_api_bus_detail(self): self.make_token() - route_1 = Route.objects.create(route_name="JT-001", bus_number="JT-001") + route_1 = Route.objects.create(route_name="JT-01", bus_number="JT-01") response = self.client.get(reverse("api_bus_detail", args=[route_1.pk]), HTTP_AUTHORIZATION=self.auth) self.assertEqual(response.status_code, 200) diff --git a/intranet/apps/bus/tests.py b/intranet/apps/bus/tests.py index a64f4754080..ccad2353090 100644 --- a/intranet/apps/bus/tests.py +++ b/intranet/apps/bus/tests.py @@ -36,7 +36,7 @@ def test_bus(self): m.assert_called() def test_routes(self): - route = Route.objects.get_or_create(route_name="JT-101", bus_number="JT-101")[0] + route = Route.objects.get_or_create(route_name="JT-01", bus_number="JT-01")[0] route.status = "a" route.space = "_1" route.save() @@ -47,7 +47,7 @@ def test_routes(self): self.assertEqual(route.space, "") def test_route_representation(self): - route = Route.objects.get_or_create(route_name="JT-101", bus_number="JT-101")[0] + route = Route.objects.get_or_create(route_name="JT-01", bus_number="JT-01")[0] route_str = str(route) self.assertEqual(route.route_name, route_str) diff --git a/intranet/apps/eighth/tests/admin/test_admin_groups.py b/intranet/apps/eighth/tests/admin/test_admin_groups.py index 662abc71536..743986564a7 100644 --- a/intranet/apps/eighth/tests/admin/test_admin_groups.py +++ b/intranet/apps/eighth/tests/admin/test_admin_groups.py @@ -166,7 +166,7 @@ def test_download_group_csv_view(self): group = Group.objects.get_or_create(name="test group 5")[0] user1 = get_user_model().objects.get_or_create(username="2021ttest", first_name="Tommy", last_name="Test", student_id=1234568)[0] user2 = get_user_model().objects.get_or_create(username="2021ttest1", first_name="Thomas", last_name="Test", student_id=1234567)[0] - user3 = get_user_model().objects.get_or_create(username="2021awilliam", first_name="A", last_name="William", student_id=12345679)[0] + user3 = get_user_model().objects.get_or_create(username="2021awilliam", first_name="A", last_name="William", student_id=1234569)[0] for member in [user1, user2, user3]: member.groups.add(group) member.save() @@ -205,7 +205,7 @@ def test_eighth_admin_signup_group(self): username="2021awilliam", first_name="A", last_name="William", - student_id=12345679, + student_id=1234569, user_type="student", graduation_year=get_senior_graduation_year(), )[0] @@ -281,7 +281,7 @@ def test_eighth_admin_distribute_group(self): username="2021awilliam", first_name="A", last_name="William", - student_id=12345679, + student_id=1234569, user_type="student", graduation_year=get_senior_graduation_year(), )[0] @@ -352,7 +352,7 @@ def test_eighth_admin_distribute_unsigned(self): username="2021awilliam", first_name="A", last_name="William", - student_id=12345679, + student_id=1234569, user_type="student", graduation_year=get_senior_graduation_year(), )[0] @@ -417,7 +417,7 @@ def test_eighth_admin_distribute_action(self): username="2021awilliam", first_name="A", last_name="William", - student_id=12345679, + student_id=1234569, user_type="student", graduation_year=get_senior_graduation_year(), )[0] diff --git a/intranet/apps/events/tests.py b/intranet/apps/events/tests.py index b9801e1812c..a2b83717d1f 100644 --- a/intranet/apps/events/tests.py +++ b/intranet/apps/events/tests.py @@ -143,7 +143,7 @@ def test_add_event(self): "location": "Location", "scheduled_activity": "", "announcement": "", - "groups": 1, + "groups": [], "show_attending": "on", "show_on_dashboard": "on", "category": "sports", @@ -228,7 +228,7 @@ def test_modify_event(self): "location": "New location", "scheduled_activity": "", "announcement": "", - "groups": 1, + "groups": [], "show_attending": "on", "show_on_dashboard": "on", "category": "sports", diff --git a/intranet/settings/__init__.py b/intranet/settings/__init__.py index dd339e751c3..688d6bd2ac7 100644 --- a/intranet/settings/__init__.py +++ b/intranet/settings/__init__.py @@ -71,7 +71,7 @@ PRODUCTION = os.getenv("PRODUCTION", "").upper() == "TRUE" IN_CI = any(os.getenv(key, "").upper() == "TRUE" for key in ["TRAVIS", "GITHUB_ACTIONS"]) # FIXME: figure out a less-hacky way to do this. -TESTING = "test" in sys.argv +TESTING = "test" in sys.argv and not IN_CI LOGGING_VERBOSE = PRODUCTION # Whether to report master password attempts diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 00000000000..8553dc27eec --- /dev/null +++ b/pytest.ini @@ -0,0 +1,3 @@ +[pytest] +DJANGO_SETTINGS_MODULE = intranet.settings +python_files = tests.py test_*.py