コード例 #1
0
    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)
コード例 #2
0
    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)