diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..d7f8b49 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,36 @@ +name: Django CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + max-parallel: 4 + matrix: + python-version: [3.11] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install Dependencies + run: | + python -m pip install --upgrade pip + cd api + pip install -r requirements.txt + - name: Copy .env + run: | + cd api + cp .env.cicd .env + - name: Run Tests + run: | + cd api + python manage.py test \ No newline at end of file diff --git a/api/masteriqapp/tests/test_routes.py b/api/masteriqapp/tests/test_routes.py index c69e57e..5f44b8b 100644 --- a/api/masteriqapp/tests/test_routes.py +++ b/api/masteriqapp/tests/test_routes.py @@ -6,7 +6,8 @@ class RouteTestCases(TestCase): def test_route(self): c = Client() - response = c.post("/api/user/signup/", {"username":"test", "password":"test"}) + response = c.post("/api/user/register/", {"username":"test", "password":"test"}) + print(response.status_code) assert response.status_code == 201 response = c.get("/api/category/1/image/")