Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: '3'

services:
mockserver:
image: mockserver/mockserver:latest
ports:
- "1080:1080"
volumes:
- ./tests/mocks:/config
environment:
MOCKSERVER_INITIALIZATION_JSON_PATH: /config/telegram_expectations.json
networks:
- test-network

sysblokbot:
container_name: sysblokbot-test
build:
context: .
dockerfile: Dockerfile.dev
depends_on:
- mockserver
environment:
- ENVIRONMENT=local
- TELEGRAM_BASE_URL=http://mockserver:1080
volumes:
- ./config_override.json:/app/config_override.json
networks:
- test-network

networks:
test-network:
driver: bridge

162 changes: 162 additions & 0 deletions tests/mocks/telegram_expectations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
[
{
"httpRequest": {
"method": "POST",
"path": "/bot.*/getMe"
},
"httpResponse": {
"statusCode": 200,
"headers": {
"Content-Type": ["application/json"]
},
"body": {
"ok": true,
"result": {
"id": 123456789,
"is_bot": true,
"first_name": "TestBot",
"username": "test_bot",
"can_join_groups": true,
"can_read_all_group_messages": false,
"supports_inline_queries": false
}
}
}
},
{
"httpRequest": {
"method": "POST",
"path": "/bot.*/getUpdates"
},
"httpResponse": {
"statusCode": 200,
"headers": {
"Content-Type": ["application/json"]
},
"body": {
"ok": true,
"result": []
}
}
},
{
"httpRequest": {
"method": "POST",
"path": "/bot.*/sendMessage"
},
"httpResponse": {
"statusCode": 200,
"headers": {
"Content-Type": ["application/json"]
},
"body": {
"ok": true,
"result": {
"message_id": 1,
"from": {
"id": 123456789,
"is_bot": true,
"first_name": "TestBot",
"username": "test_bot"
},
"chat": {
"id": 1,
"first_name": "Test",
"type": "private"
},
"date": 1234567890,
"text": "Message sent"
}
}
}
},
{
"httpRequest": {
"method": "GET",
"path": "/bot.*/sendMessage"
},
"httpResponse": {
"statusCode": 200,
"headers": {
"Content-Type": ["application/json"]
},
"body": {
"ok": true,
"result": {
"message_id": 1,
"from": {
"id": 123456789,
"is_bot": true,
"first_name": "TestBot",
"username": "test_bot"
},
"chat": {
"id": 1,
"first_name": "Test",
"type": "private"
},
"date": 1234567890,
"text": "Message sent"
}
}
}
},
{
"httpRequest": {
"method": "GET",
"path": "/bot.*/sendPoll"
},
"httpResponse": {
"statusCode": 200,
"headers": {
"Content-Type": ["application/json"]
},
"body": {
"ok": true,
"result": {
"message_id": 2,
"from": {
"id": 123456789,
"is_bot": true,
"first_name": "TestBot",
"username": "test_bot"
},
"chat": {
"id": 1,
"first_name": "Test",
"type": "private"
},
"date": 1234567890,
"poll": {
"id": "poll123",
"question": "Test poll",
"options": [],
"total_voter_count": 0,
"is_closed": false,
"is_anonymous": true,
"type": "regular",
"allows_multiple_answers": false
}
}
}
}
},
{
"httpRequest": {
"method": "POST",
"path": "/bot.*/deleteWebhook"
},
"httpResponse": {
"statusCode": 200,
"headers": {
"Content-Type": ["application/json"]
},
"body": {
"ok": true,
"result": true,
"description": "Webhook was deleted"
}
}
}
]