Example #1
0
 def test_get_repo_status_list_contains_scripts(self):
     self.status_list = git_check.get_repo_status_list()
     self.found_scripts = False
     for repo_status in self.status_list:
         if repo_status['path'] == self.scripts_dir:
             self.found_scripts = True
     assert self.found_scripts == True
Example #2
0
 def test_get_repo_status_list_contents(self):
     self.status_list = git_check.get_repo_status_list() # default branches = True
     for repo_status in self.status_list:
         assert 'path' in repo_status
         assert 'state' in repo_status
         assert isinstance(repo_status['path'], str)
         assert isinstance(repo_status['state'], str)
         assert repo_status['state'] in ('clean', 'dirty', 'out-of-sync',
                                         'missing', 'not_folder', 'not_repo',
                                         'error', 'check_failed')
Example #3
0
 def test_get_repo_status_list_contents_with_branches(self):
     self.status_list = git_check.get_repo_status_list(branches=True)
     for repo_status in self.status_list:
         if repo_status['state'] in ['clean', 'dirty']:
             assert 'branches' in repo_status
             assert isinstance(repo_status['branches'], list)
             assert len(repo_status['branches']) > 0
             for branch_info in repo_status['branches']:
                 assert isinstance(branch_info, dict)
                 assert isinstance(branch_info['name'], str)
                 assert isinstance(branch_info['state'], str)
                 assert branch_info['state'] in ('synced', 'behind', 'ahead',
                                                 'out-of-sync', 'untracked')
Example #4
0
 def test_get_repo_status_list_length(self):
     self.path_list = git_check.get_repo_path_list()
     self.status_list = git_check.get_repo_status_list()
     assert len(self.status_list) == len (self.path_list)
Example #5
0
 def test_get_repo_status_list_no_output(self, capsys):
     self.status_list = git_check.get_repo_status_list()
     captured = capsys.readouterr()
     assert len(captured.out) == 0
Example #6
0
 def test_get_repo_status_list_invalid_input(self):
     with pytest.raises(ValueError):
         git_check.get_repo_status_list('false')
     with pytest.raises(ValueError):
         git_check.get_repo_status_list('True')
     with pytest.raises(ValueError):
         git_check.get_repo_status_list('Random text')
     with pytest.raises(ValueError):
         git_check.get_repo_status_list(1)
     with pytest.raises(ValueError):
         git_check.get_repo_status_list(0)
     with pytest.raises(ValueError):
         git_check.get_repo_status_list(3.142)
     with pytest.raises(ValueError):
         git_check.get_repo_status_list(99999999)
     with pytest.raises(ValueError):
         git_check.get_repo_status_list('/usr/bin')
     with pytest.raises(ValueError):
         git_check.get_repo_status_list('C:\\Windows\\')
     with pytest.raises(ValueError):
         git_check.get_repo_status_list(self.test_repo)
Example #7
0
 def test_get_repo_status_list_contents_default(self):
     self.status_list = git_check.get_repo_status_list() # default branches = True
     for repo_status in self.status_list:
         if repo_status['state'] in ['clean', 'dirty']:
             assert 'branches' in repo_status
Example #8
0
 def test_get_repo_status_list_contents_no_branches(self):
     self.status_list = git_check.get_repo_status_list(branches=False)
     for repo_status in self.status_list:
         assert 'branches' not in repo_status