~nskaggs/help-app/functional-test-template

« back to all changes in this revision

Viewing changes to internals/tests/test_files.py

  • Committer: Daniel Holbach
  • Date: 2015-03-19 17:54:55 UTC
  • mfrom: (111.2.14 1429896)
  • Revision ID: daniel.holbach@canonical.com-20150319175455-sjwdzzy3aqaaiu9u
mergedĀ lp:~dholbach/help-app/1429896

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
import os
2
2
from unittest import TestCase
3
3
 
4
 
import translations
 
4
from translations.build import Translations
 
5
from translations import utils
5
6
 
6
7
 
7
8
class HelpTestCase(TestCase):
8
9
    def __init__(self, *args):
9
 
        self.translations = translations.Translations()
 
10
        self.translations = Translations()
10
11
        TestCase.__init__(self, *args)
11
12
 
12
13
    def test_doc_files_size_not_0(self):
 
14
        pwd = utils.use_top_level_dir()
13
15
        sizes = [os.stat(fn).st_size
14
16
                 for fn in self.translations.documents.docs]
15
17
        self.assertNotIn(0, sizes)
 
18
        os.chdir(pwd)
16
19
 
17
20
    def test_po_files_size_not_0(self):
 
21
        pwd = utils.use_top_level_dir()
18
22
        sizes = [os.stat(fn).st_size
19
23
                 for fn in self.translations.po.langs]
20
24
        self.assertNotIn(0, sizes)
 
25
        os.chdir(pwd)
21
26
 
22
27
    def test_markdown_files(self):
23
28
        fns = self.translations.documents.find_docs()
24
 
        checked_fns = [translations.verify_markdown_file(fn)
 
29
        checked_fns = [utils.verify_markdown_file(fn)
25
30
                       for fn in fns]
26
31
        self.assertEqual(len(fns), checked_fns.count(True))