~andrewsomething/+junk/google-webfont-downloader

« back to all changes in this revision

Viewing changes to tests/test_example.py

  • Committer: Andrew Starr-Bochicchio
  • Date: 2012-08-31 04:58:13 UTC
  • Revision ID: a.starr.b@gmail.com-20120831045813-agbxwt3n7thyb6ss
Break out get_fonts_json into its own function and add a test for it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
import unittest
21
21
sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__), "..")))
22
22
import tempfile
23
 
 
 
23
import json
24
24
from google_webfont_downloader import AboutGoogleWebfontDownloaderDialog
25
25
from google_webfont_downloader.DownloadFont import extract_url, write_font_file
26
 
from google_webfont_downloader.FindFonts import process_json, cache_json
 
26
from google_webfont_downloader.FindFonts import process_json, cache_json, get_fonts_json
27
27
from google_webfont_downloader_lib.xdg import cacheDir
28
28
 
29
29
class TestCases(unittest.TestCase):
60
60
        with open(os.path.join(cacheDir + "webfonts.json")) as f:
61
61
            self.assertEqual(f.read(), fake_json_data)
62
62
 
 
63
    def test_get_fonts_json(self):
 
64
        returned_data = get_fonts_json()
 
65
        self.assertTrue(json.loads(str(returned_data),"utf-8"))
63
66
 
64
67
fake_json_data = """{
65
68
 "kind": "webfonts#webfontList",