Create example marker to avoid tests that require external domain

This commit is contained in:
Jim Fingal 2020-11-08 13:07:37 -08:00
parent e1e5dd8b0d
commit 1f9891dcf5
3 changed files with 9 additions and 2 deletions

View file

@ -6,6 +6,8 @@ import pathlib
import json
import responses
import pytest
from django.test import TestCase, Client
from django.utils.http import http_date
@ -167,6 +169,7 @@ class Signature(TestCase):
response = self.send_test_request(sender=self.fake_remote)
self.assertEqual(response.status_code, 401)
@pytest.mark.integration
def test_changed_data(self):
'''Message data must match the digest header.'''
response = self.send_test_request(
@ -174,12 +177,14 @@ class Signature(TestCase):
send_data=get_follow_data(self.mouse, self.cat))
self.assertEqual(response.status_code, 401)
@pytest.mark.integration
def test_invalid_digest(self):
response = self.send_test_request(
self.mouse,
digest='SHA-256=AAAAAAAAAAAAAAAAAA')
self.assertEqual(response.status_code, 401)
@pytest.mark.integration
def test_old_message(self):
'''Old messages should be rejected to prevent replay attacks.'''
response = self.send_test_request(

2
fr-dev
View file

@ -13,7 +13,7 @@ function rundb {
}
function runweb {
docker-compose run --rm web $@
docker-compose run --rm web "$@"
clean
}

View file

@ -2,3 +2,5 @@
DJANGO_SETTINGS_MODULE = bookwyrm.settings
python_files = tests.py test_*.py *_tests.py
addopts = --cov=bookwyrm --cov-config=.coveragerc
markers =
integration: marks tests as requiring external resources (deselect with '-m "not integration"')