コード例 #1
0
ファイル: test_root.py プロジェクト: honestica/ywh2bugtracker
 def test_validate_no_trackers(self) -> None:
     root = RootConfiguration(
         bugtrackers=Trackers(),
         yeswehack=YesWeHackConfigurations(my_ywh=YesWeHackConfiguration(
             api_url='http://example.com',
             login='******',
             password='******',
             oauth_args=OAuthSettings(
                 client_id='client-id',
                 client_secret='client-secret',
                 redirect_uri='http://example.com/oauth/redirect',
             ),
             apps_headers=Headers({
                 'X-YesWeHack-Apps': '123',
             }, ),
             verify=True,
             programs=Programs([
                 Program(
                     slug='1-pgm',
                     bugtrackers_name=Bugtrackers([
                         'my_gitlab',
                         'my_github',
                     ], ),
                 ),
             ], ),
         ), ),
     )
     with self.assertRaises(AttributesError):
         root.validate()
コード例 #2
0
 def test_validate_no_trackers(self) -> None:
     root = RootConfiguration(
         bugtrackers=Trackers(),
         yeswehack=YesWeHackConfigurations(
             my_ywh=YesWeHackConfiguration(
                 api_url='http://example.com',
                 pat='e2d00087-a2fa-4fe2-ac1c-7abf1da2a036',
                 verify=True,
                 programs=Programs(
                     [
                         Program(
                             slug='1-pgm',
                             bugtrackers_name=Bugtrackers(
                                 [
                                     'my_gitlab',
                                     'my_github',
                                 ],
                             ),
                         ),
                     ],
                 ),
             ),
         ),
     )
     with self.assertRaises(AttributesError):
         root.validate()
コード例 #3
0
 def _build_configuration(
     self,
     tracker_key: str = 'tracker',
 ) -> RootConfiguration:
     return RootConfiguration(
         yeswehack=YesWeHackConfigurations(ywh_test=YesWeHackConfiguration(
             apps_headers=Headers(**{
                 'X-YesWeHack-Apps': 'qwerty',
             }, ),
             login='******',
             password='******',
             programs=Programs(items=[
                 Program(
                     slug='program1',
                     bugtrackers_name=Bugtrackers([
                         tracker_key,
                     ], ),
                 ),
             ], ),
         ), ),
         bugtrackers=Trackers(
             **{
                 tracker_key: MyTrackerTrackerConfiguration(),
             }, ),
     )
コード例 #4
0
ファイル: root.py プロジェクト: yeswehack/ywh2bugtracker
 def _ensure_declared_trackers(
     self,
     trackers: Trackers,
     yeswehack: YesWeHackConfigurations,
 ) -> Dict[str, AttributesError]:
     errors = {}
     for yeswehack_name, yeswehack_config in yeswehack.items():
         config_errors = self._ensure_bugtrackers_name(
             trackers=trackers,
             programs=cast(Programs, yeswehack_config.programs or {}),
         )
         for key, error in config_errors.items():
             errors[f'yeswehack.{yeswehack_name}.{key}'] = error
     return errors
コード例 #5
0
ファイル: test_root.py プロジェクト: honestica/ywh2bugtracker
 def test_validate(self) -> None:
     root = RootConfiguration(
         bugtrackers=Trackers(
             my_gitlab=GitLabConfiguration(
                 token='gl-token',
                 project='my-project',
             ),
             my_github=GitHubConfiguration(
                 token='gh-token',
                 project='project',
             ),
         ),
         yeswehack=YesWeHackConfigurations(my_ywh=YesWeHackConfiguration(
             api_url='http://example.com',
             login='******',
             password='******',
             oauth_args=OAuthSettings(
                 client_id='client-id',
                 client_secret='client-secret',
                 redirect_uri='http://example.com/oauth/redirect',
             ),
             apps_headers=Headers({
                 'X-YesWeHack-Apps': '123',
             }, ),
             verify=True,
             programs=Programs([
                 Program(
                     slug='1-pgm',
                     bugtrackers_name=Bugtrackers([
                         'my_gitlab',
                     ], ),
                 ),
                 Program(
                     slug='1-pgm',
                     bugtrackers_name=Bugtrackers([
                         'my_github',
                     ], ),
                 ),
             ], ),
         ), ),
     )
     root.validate()
コード例 #6
0
 def test_validate(self) -> None:
     root = RootConfiguration(
         bugtrackers=Trackers(
             my_gitlab=GitLabConfiguration(
                 token='gl-token',
                 project='my-project',
             ),
             my_github=GitHubConfiguration(
                 token='gh-token',
                 project='project',
             ),
         ),
         yeswehack=YesWeHackConfigurations(
             my_ywh=YesWeHackConfiguration(
                 api_url='http://example.com',
                 pat='e2d00087-a2fa-4fe2-ac1c-7abf1da2a036',
                 verify=True,
                 programs=Programs(
                     [
                         Program(
                             slug='1-pgm',
                             bugtrackers_name=Bugtrackers(
                                 [
                                     'my_gitlab',
                                 ],
                             ),
                         ),
                         Program(
                             slug='1-pgm',
                             bugtrackers_name=Bugtrackers(
                                 [
                                     'my_github',
                                 ],
                             ),
                         ),
                     ],
                 ),
             ),
         ),
     )
     root.validate()