def test_post_record(self): topic: FlexioTopic = FlexioTopic() topic.title = 'test' topic.body = 'dudu' topic.state = IssueState.OPEN print(topic.to_api_dict()) r: Response = FlexioClient( self.config_handler).post_record(record=topic) topic_created: FlexioTopic = FlexioTopic.build_from_api(r.json()) self.assertEqual(topic.title, topic_created.title) self.assertEqual(topic.body, topic_created.body) self.assertEqual(topic.state, topic_created.state) print(topic_created.__dict__()) self.assertIs(r.status_code, 200) falsy_config_handler = ConfigHandler(CONFIG_DIR) falsy_config_handler.config = Config().with_flexio( ConfigFlexio(activate=True, user_token='dudu')) r: Response = FlexioClient(falsy_config_handler).post_record( record=topic) self.assertIsNot(r.status_code, 200)
def test_get_users(self): r: Response = self.github_repo.get_users() self.assertIs(r.status_code, 200) print(r.json()) falsy_config_handler = ConfigHandler(CONFIG_DIR) falsy_config_handler.config = Config().with_github( ConfigGithub(activate=True, user='******', token='dudu')) r: Response = Github(falsy_config_handler).get_user() self.assertIsNot(r.status_code, 200)
def __init__(self, state_handler: StateHandler, config_handler: ConfigHandler, issue: Optional[Type[Issue]], topics: Optional[List[Topic]], keep_branch: bool, close_issue: bool): self.__state_handler: StateHandler = state_handler self.__config_handler: ConfigHandler = config_handler self.__issue: Optional[Type[Issue]] = issue self.__topics: Optional[List[Topic]] = topics self.__git: GitCmd = GitCmd(self.__state_handler) self.__gitflow: GitFlowCmd = GitFlowCmd(self.__state_handler, config_handler) self.__keep_branch: bool = keep_branch self.__close_issue: bool = close_issue self.__name: str = self.__git.get_branch_name_from_git( config_handler.release()) self.__version_check: str = self.__state_handler.version_as_str()
def setup_config_handler(cls) -> ConfigHandler: config_handler: ConfigHandler = ConfigHandler(cls.DIR_PATH_TEST) config_handler.config = Config().with_github( github=ConfigGithub(activate=True, user=USER, token=TOKEN_TEST)) return config_handler
def setUp(self): self.config_handler = ConfigHandler(CONFIG_DIR) self.config_handler.config = Config().with_flexio( ConfigFlexio(activate=True, user_token=USER_TOKEN))
def setUp(self): self.config_handler = ConfigHandler(CONFIG_DIR) self.config_handler.config = Config().with_github( ConfigGithub(activate=True, user=USER, token=TOKEN_TEST)) self.github_repo: Github = Github(self.config_handler).with_repo( Repo(owner='flexiooss', repo='flexio-flow-punching-ball'))