Beispiel #1
0
 def test_config_contains_api_key(self):
     """check if 'settings-local.py' contains API key"""
     console.main()
     api_key_line = re.compile('API_KEY = \'[0-9a-z]{32}\'')
     _settings_local = os.path.join(settings._user_config_dir,
                                    'settings-local.py')
     msg = 'settings-local.py does not include API_KEY string'
     with open(_settings_local) as settings_file:
         self.assertRegexpMatches(settings_file.read(), api_key_line, msg)
 def test_config_contains_api_key(self):
     """check if 'settings-local.py' contains API key"""
     console.main()
     api_key_line = re.compile('API_KEY = \'[0-9a-z]{32}\'')
     _settings_local = os.path.join(
         settings._user_config_dir, 'settings-local.py'
     )
     msg = 'settings-local.py does not include API_KEY string'
     with open(_settings_local) as settings_file:
         self.assertRegexpMatches(settings_file.read(), api_key_line, msg)
Beispiel #3
0
 def test_config_contains_project_name(self):
     """check if 'settings-local.py' contains project's name"""
     console.main()
     project_name_line = "PROJECT_NAME = 'test_project'"
     _settings_local = os.path.join(settings._user_config_dir,
                                    'settings-local.py')
     msg = 'settings-local.py does not include {}'.format(
         repr(project_name_line))
     with open(_settings_local) as settings_file:
         self.assertIn(project_name_line, settings_file.read(), msg)
 def test_config_contains_project_name(self):
     """check if 'settings-local.py' contains project's name"""
     console.main()
     project_name_line = "PROJECT_NAME = 'test_project'"
     _settings_local = os.path.join(
         settings._user_config_dir, 'settings-local.py'
     )
     msg = 'settings-local.py does not include {}'.format(
         repr(project_name_line)
     )
     with open(_settings_local) as settings_file:
         self.assertIn(project_name_line, settings_file.read(), msg)
    def test_all_files_created(self):
        """
        check if command 'create_project test_project' creates required
        project structure.

        project structure contains:
            ~/.tipboard
                custom_tiles
                layout_config.yaml
                settings-local.py
        """
        console.main()
        config_paths = self.project_config_paths()
        for path_to_check in config_paths:
            self.assertTrue(os.path.exists(path_to_check))
Beispiel #6
0
    def test_all_files_created(self):
        """
        check if command 'create_project test_project' creates required
        project structure.

        project structure contains:
            ~/.tipboard
                custom_tiles
                layout_config.yaml
                settings-local.py
        """
        console.main()
        config_paths = self.project_config_paths()
        for path_to_check in config_paths:
            self.assertTrue(os.path.exists(path_to_check))
 def test_recreate_project(self):
     """
     check if command 'create_project test_project' called twice
     doesn't affect already existing '~/.tipboard' dir
     """
     console.main()
     config_paths = self.project_config_paths()
     first_times, second_times = [], []
     for path in config_paths:
         mod_time = time.ctime(os.path.getmtime(path))
         first_times.append(mod_time)
     time.sleep(0.1)
     console.main()
     for path in config_paths:
         mod_time = time.ctime(os.path.getmtime(path))
         second_times.append(mod_time)
     for first_time, second_time in zip(first_times, second_times):
         item_idx = first_times.index(first_time)
         msg = u"file has changed: {}".format(config_paths[item_idx])
         self.assertEqual(first_time, second_time, msg)
Beispiel #8
0
 def test_recreate_project(self):
     """
     check if command 'create_project test_project' called twice
     doesn't affect already existing '~/.tipboard' dir
     """
     console.main()
     config_paths = self.project_config_paths()
     first_times, second_times = [], []
     for path in config_paths:
         mod_time = time.ctime(os.path.getmtime(path))
         first_times.append(mod_time)
     time.sleep(0.1)
     console.main()
     for path in config_paths:
         mod_time = time.ctime(os.path.getmtime(path))
         second_times.append(mod_time)
     for first_time, second_time in zip(first_times, second_times):
         item_idx = first_times.index(first_time)
         msg = u"file has changed: {}".format(config_paths[item_idx])
         self.assertEqual(first_time, second_time, msg)
Beispiel #9
0
def _create_test_project():
    console.main()
Beispiel #10
0
def _create_test_project():
    console.main()