Coverage for tld/tests/test_commands.py: 74%

23 statements  

« prev     ^ index     » next       coverage.py v7.4.4, created at 2024-05-27 05:40 +0000

1# -*- coding: utf-8 -*- 

2 

3import logging 

4import subprocess 

5import unittest 

6 

7from .base import internet_available_only, log_info 

8 

9__author__ = "Artur Barseghyan" 

10__copyright__ = "2013-2023 Artur Barseghyan" 

11__license__ = "GPL 2.0/LGPL 2.1" 

12__all__ = ("TestCommands",) 

13 

14LOGGER = logging.getLogger(__name__) 

15 

16 

17class TestCommands(unittest.TestCase): 

18 """Tld commands tests.""" 

19 

20 def setUp(self): 

21 """Set up.""" 

22 

23 @internet_available_only 

24 @log_info 

25 def test_1_update_tld_names_command(self): 

26 """Test updating the tld names (re-fetch mozilla source).""" 

27 res = subprocess.check_output(["update-tld-names"]).strip() 

28 self.assertEqual(res, b"") 

29 return res 

30 

31 @internet_available_only 

32 @log_info 

33 def test_1_update_tld_names_mozilla_command(self): 

34 """Test updating the tld names (re-fetch mozilla source).""" 

35 res = subprocess.check_output(["update-tld-names", "mozilla"]).strip() 

36 self.assertEqual(res, b"") 

37 return res