Пример #1
0
 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
 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
 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()