Skip to content

Commit

Permalink
Merge branch 'Clueless-Community:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
arpy8 authored Jun 6, 2024
2 parents 44a16d4 + 02fd2c1 commit 6db6fc3
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/pr_merged.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Auto Comment on PR Merged

on:
pull_request_target:
types: [closed]

permissions:
issues: write
pull-requests: write

jobs:
comment:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
- name: Add Comment to Pull Request
run: |
COMMENT=$(cat <<EOF
{
"body": "Great work @${{ github.event.pull_request.user.login }} !! \nDo not forget to \n+ Share your contribution on socials and tag Clueless 🫂 \n+ Give this repository a star ✨ \n+ Follow Clueless Community on GitHub ✅"
}
EOF
)
RESPONSE=$(curl -s -o response.json -w "%{http_code}" \
-X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
-d "$COMMENT")
cat response.json
if [ "$RESPONSE" -ne 201 ]; then
echo "Failed to add comment"
exit 1
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33 changes: 33 additions & 0 deletions src/test/banners_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import unittest
from src.scrape_up.banners import Scraper88x31


class TestScraper88x31(unittest.TestCase):

def setUp(self):
"""
Initialize a Scraper88x31 instance before each test method.
"""
self.scraper = Scraper88x31()

def test_get_all(self):
"""
| Methods | Details |
| ------------------ | -------------------------------------------------------- |
| `get_all()` | Returns the list of all available 88x31 banners |
"""
try:
banners = self.scraper.get_all()

# Check if banners is a list of URLs
self.assertIsInstance(banners, list)
for banner in banners:
self.assertIsInstance(banner, str)
self.assertTrue(banner.startswith("https://cyber.dabamos.de/88x31/"))
self.assertTrue(banner.endswith(".gif"))
except:
return None


if __name__ == "__main__":
unittest.main()

0 comments on commit 6db6fc3

Please sign in to comment.