Skip to content

Commit

Permalink
Merge pull request #5 from ravachol-yang/alkjscasjc
Browse files Browse the repository at this point in the history
Added unit test and testing workflows
  • Loading branch information
ravachol-yang authored Mar 23, 2024
2 parents bff72d4 + d42f74d commit f539c5c
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 1 deletion.
29 changes: 29 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Randomology

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt
- name: Test with pytest
run: |
python3 -m pytest
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
**/__pycache__/**
**~
**/.venv**/**

**/.pytest_cache/**
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
certifi==2024.2.2
charset-normalizer==3.3.2
idna==3.6
iniconfig==2.0.0
packaging==24.0
pluggy==1.4.0
pyTelegramBotAPI==4.16.1
pytest==8.1.1
requests==2.31.0
urllib3==2.2.1
11 changes: 11 additions & 0 deletions tests/text_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# text tests

from app.services.text_service import generate_random_text

def test_text_generated():
text = generate_random_text()
assert isinstance(text, str)

def test_text_length():
text = generate_random_text()
assert len(text) >= 30 and len(text) <= 120

0 comments on commit f539c5c

Please sign in to comment.