mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2026-04-26 01:26:00 +03:00
[PR #357] [MERGED] Test Mock alternative. Proof of concept. #4134
Labels
No labels
expected: maybe someday
expected: next release
expected: release after next
expected: unlikely unless contributed
good first ticket
help wanted
pull-request
scope: all users
scope: windows users
size: easy
size: hard
size: medium
size: medium
status: backlog
status: blocked
status: done
status: idea-phase
status: needs followup
status: wip
status: wontfix
touches: API/CLI/Spec
touches: configuration
touches: data/schema/architecture
touches: dependencies/packaging
touches: docs
touches: js
touches: views/replayers/html/css
why: correctness
why: functionality
why: performance
why: security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ArchiveBox#4134
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ArchiveBox/ArchiveBox/pull/357
Author: @cdvv7788
Created: 7/7/2020
Status: ✅ Merged
Merged: 7/13/2020
Merged by: @pirate
Base:
django← Head:mock-poc📝 Commits (4)
bf417f5feat: Add bottle webserver to run along with tests8f2543ftest: Refactor args tests to use local webserver instead of remote requestsfe80a93test: Refactor init tests to use local webserver322997etest: Refactor util tests to use local webserver📊 Changes
9 files changed (+487 additions, -11 deletions)
View changed files
📝
setup.py(+1 -0)➕
tests/conftest.py(+19 -0)➕
tests/mock_server/__init__.py(+0 -0)➕
tests/mock_server/server.py(+17 -0)➕
tests/mock_server/templates/example.com.html(+49 -0)➕
tests/mock_server/templates/iana.org.html(+390 -0)📝
tests/test_args.py(+8 -8)📝
tests/test_init.py(+2 -2)📝
tests/test_util.py(+1 -1)📄 Description
Summary
There are cases where playing with the headers and other information in the urls we pass to
archiveboxis actually useful. If we use something likehttmockwe would need to know a lot about the internals of several bits of the application, and the tests would need to be updated so they read the mocked version instead of the original one.Instead of that, we could run a small webserver that serves real content locally, and we can update the tests to consume the content from there. This better reflects the actual behavior the application will have in real usage, and the tests will be kept clean, as the application will be doing exactly the same it does outside testing.
This is a small POC that runs a
bottleserver while the tests are running.Changes these areas
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.