def test_multi_key_gitlab_pass_except(): data = { "owner": "user" } content = multi_key_gitlab(data) assert content == None
def _repo_id(self): """ Searches and returns the repository ID based on the repository name. If the repository is not found then a table of repository is shown so that the user can manually enter the ID of their repository. :returns: Repository ID :return: id_number :rtype: int """ url = self.api_url + 'projects?search={}'.format(self.info.name) r = requests.get(url=url, headers=self.request_headers) id_number = json.loads(r.text) if len(id_number) > 1: print( "The search resulted in more that one repository. Please check your repository name and type in it's ID") print('ID - Repository Name - Username') for content in id_number: print('{id} - {repo_name} - {user_name}'.format(id=content['id'], repo_name=content['name'], user_name=multi_key_gitlab(content))) id_number = input('ID > ') return id_number try: return id_number[0]['id'] except KeyError: raise KeyError('Wrong credentials given. Please check if you have the correct token.')
def test_multi_key_gitlab_pass(): data = { "owner": { "username": "******" } } content = multi_key_gitlab(data) assert content == "user"