From 16f044d221e6a1fd67ab45b74264668fcf95f6e7 Mon Sep 17 00:00:00 2001 From: "serafim.urukov" Date: Thu, 16 Sep 2021 22:24:13 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B1=D1=83=D1=8E=20=D1=8D?= =?UTF-8?q?=D0=BA=D1=88=D0=BD=20-=20=D1=82=D0=B5=D1=81=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflow/test_service.yaml | 38 ++++++++++++++++++++++++ SpreadsheetsService/tests/test_models.py | 12 +++----- 2 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 .github/workflow/test_service.yaml diff --git a/.github/workflow/test_service.yaml b/.github/workflow/test_service.yaml new file mode 100644 index 0000000..de230f1 --- /dev/null +++ b/.github/workflow/test_service.yaml @@ -0,0 +1,38 @@ +name: Тест сервиса по Google интеграции + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.x + uses: actions/setup-python@v2 + with: + # Semantic version range syntax or exact version of a Python version + python-version: "3.x" + # Optional - x64 or x86 architecture, defaults to x64 + architecture: "x64" + # You can test your matrix by printing the current Python version + - name: Display Python version + run: python -c "import sys; print(sys.version)" + - name: Cache pip + uses: actions/cache@v2 + with: + # This path is specific to Ubuntu + path: ~/.cache/pip + # Look to see if there is a cache hit for the corresponding requirements file + key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + ${{ runner.os }}- + - name: Install dependencies + run: | + cd ${{ github.workspace }}/SpreadsheetsService + pip install -r requirements.txt + - name: Run tests + run: | + pip install pytest + pytest diff --git a/SpreadsheetsService/tests/test_models.py b/SpreadsheetsService/tests/test_models.py index 11c30ed..dcc5b5e 100644 --- a/SpreadsheetsService/tests/test_models.py +++ b/SpreadsheetsService/tests/test_models.py @@ -35,12 +35,12 @@ STUDENTS = ( class TestStudent: def test_init(self): - student = Student(1, "Фарид Михайлов") + student = Student(1, "Фарид Михайлов", "42") assert student.name == "Фарид Михайлов" assert student.number == 1 def test_student_assignments(self): - student = Student(1, "Фарид Михайлов") + student = Student(1, "Фарид Михайлов", "42") ass = [Assignment(weight, values) for weight, values in ASSIGNMENTS] for a in ass: @@ -52,9 +52,10 @@ class TestStudent: class TestGroup: @staticmethod def init_group(): + group_id = 5374 group = Group(5374) for el in STUDENTS: - student = Student(el[0], el[1]) + student = Student(el[0], el[1], group_id) group.add_student(student) return group @@ -72,8 +73,3 @@ class TestGroup: students = group.find_students("Йгбо") assert len(students) == 2 - - def test_top(self): - group = self.init_group() - - group.top(5)