|
1 | 1 | # -*- coding: utf-8 -*- |
2 | 2 | import os.path |
| 3 | +#import json |
| 4 | +#from pathlib import Path |
3 | 5 |
|
4 | 6 | from textwrap import dedent |
5 | 7 | from email.mime.text import MIMEText |
|
9 | 11 | from django.conf import settings |
10 | 12 | from django.test import TestCase |
11 | 13 |
|
| 14 | +import debug # pyflakes:ignore |
| 15 | + |
12 | 16 | from ietf.utils.management.commands import pyflakes |
13 | 17 | from ietf.utils.mail import send_mail_text, send_mail_mime, outbox |
14 | 18 |
|
@@ -59,3 +63,31 @@ def send_complex_mail(to): |
59 | 63 | len_before = len(outbox) |
60 | 64 | send_complex_mail('good@example.com,poison@example.com') |
61 | 65 | self.assertEqual(len(outbox),len_before+2) |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | +## One might think that the code below would work, but it doesn't ... |
| 71 | + |
| 72 | +# def list_static_files(path): |
| 73 | +# r = Path(settings.STATIC_ROOT) |
| 74 | +# p = r / path |
| 75 | +# files = list(p.glob('**/*')) |
| 76 | +# relfn = [ str(file.relative_to(r)) for file in files ] |
| 77 | +# return relfn |
| 78 | +# |
| 79 | +# class TestBowerStaticFiles(TestCase): |
| 80 | +# |
| 81 | +# def test_bower_static_file_finder(self): |
| 82 | +# from django.templatetags.static import static |
| 83 | +# bower_json = os.path.join(settings.BASE_DIR, 'bower.json') |
| 84 | +# with open(bower_json) as file: |
| 85 | +# bower_info = json.load(file) |
| 86 | +# for asset in bower_info["dependencies"]: |
| 87 | +# files = list_static_files(asset) |
| 88 | +# self.assertGreater(len(files), 0) |
| 89 | +# for file in files: |
| 90 | +# url = static(file) |
| 91 | +# debug.show('url') |
| 92 | +# r = self.client.get(url) |
| 93 | +# self.assertEqual(r.status_code, 200) |
0 commit comments