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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import os
from unittest import TestCase

from translations.build import Translations
from translations import utils


class HelpTestCase(TestCase):
    def __init__(self, *args):
        self.translations = Translations()
        TestCase.__init__(self, *args)

    def test_doc_files_size_not_0(self):
        pwd = utils.use_top_level_dir()
        sizes = [os.stat(fn).st_size
                 for fn in self.translations.documents.docs]
        self.assertNotIn(0, sizes)
        os.chdir(pwd)

    def test_po_files_size_not_0(self):
        pwd = utils.use_top_level_dir()
        sizes = [os.stat(fn).st_size
                 for fn in self.translations.po.langs]
        self.assertNotIn(0, sizes)
        os.chdir(pwd)

    def test_markdown_files(self):
        fns = self.translations.documents.find_docs()
        checked_fns = [utils.verify_markdown_file(fn)
                       for fn in fns]
        self.assertEqual(len(fns), checked_fns.count(True))