예제 #1
0
    def test_positive_synchronize_auth_puppet_repo(self):
        """Check if secured puppet repository can be created and synced

        @id: a1e25d36-baae-46cb-aa3b-5cb9fca4f059

        @Assert: Repository is created and synced

        @CaseLevel: Integration
        """
        url = FAKE_7_PUPPET_REPO
        for creds in [cred for cred in valid_http_credentials(url_encoded=True)
                      if cred['http_valid']]:
            url_encoded = url.format(creds['login'], creds['pass'])
            with self.subTest(url):
                repo = entities.Repository(
                    product=self.product,
                    content_type='puppet',
                    url=url_encoded,
                ).create()
                # Assertion that repo is not yet synced
                self.assertEqual(repo.content_counts['puppet_module'], 0)
                # Synchronize it
                repo.sync()
                # Verify it has finished
                self.assertEqual(
                    repo.read().content_counts['puppet_module'], 1)
예제 #2
0
    def test_negative_update_auth_url_with_special_characters(self):
        """Verify that repository URL credentials cannot be updated to contain
        the forbidden characters

        @id: 566553b2-d077-4fd8-8ed5-00ba75355386

        @Assert: Repository url not updated
        """
        new_repo = self._make_repository()
        # get auth repos with credentials containing unquoted special chars
        auth_repos = [
            repo.format(cred['login'], cred['pass'])
            for cred in valid_http_credentials() if cred['quote']
            for repo in (FAKE_5_YUM_REPO, FAKE_7_PUPPET_REPO)
        ]

        for url in auth_repos:
            with self.subTest(url):
                with self.assertRaises(CLIReturnCodeError):
                    Repository.update({
                        u'id': new_repo['id'],
                        u'url': url,
                    })
                # Fetch it again
                result = Repository.info({'id': new_repo['id']})
                self.assertEqual(result['url'], new_repo['url'])
예제 #3
0
    def test_positive_synchronize_auth_yum_repo(self):
        """Check if secured repository can be created and synced

        @id: b0db676b-e0f0-428c-adf3-1d7c0c3599f0

        @Assert: Repository is created and synced

        @CaseLevel: Integration
        """
        url = FAKE_5_YUM_REPO
        for creds in [cred for cred in valid_http_credentials(url_encoded=True)
                      if cred['http_valid']]:
            url_encoded = url.format(
                creds['login'], creds['pass']
            )
            with self.subTest(url):
                new_repo = self._make_repository({
                    u'content-type': u'yum',
                    u'url': url_encoded,
                })
                # Assertion that repo is not yet synced
                self.assertEqual(new_repo['sync']['status'], 'Not Synced')
                # Synchronize it
                Repository.synchronize({'id': new_repo['id']})
                # Verify it has finished
                new_repo = Repository.info({'id': new_repo['id']})
                self.assertEqual(new_repo['sync']['status'], 'Success')
예제 #4
0
    def test_positive_synchronize_auth_puppet_repo(self):
        """Check if secured puppet repository can be created and synced

        @id: 1d2604fc-8a18-4cbe-bf4c-5c7d9fbdb82c

        @Assert: Repository is created and synced

        @CaseLevel: Integration
        """
        url = FAKE_7_PUPPET_REPO
        for creds in [
                cred for cred in valid_http_credentials(url_encoded=True)
                if cred['http_valid']
        ]:
            url_encoded = url.format(creds['login'], creds['pass'])
            with self.subTest(url):
                new_repo = self._make_repository({
                    u'content-type': u'yum',
                    u'url': url_encoded,
                })
                # Assertion that repo is not yet synced
                self.assertEqual(new_repo['sync']['status'], 'Not Synced')
                # Synchronize it
                Repository.synchronize({'id': new_repo['id']})
                # Verify it has finished
                new_repo = Repository.info({'id': new_repo['id']})
                self.assertEqual(new_repo['sync']['status'], 'Success')
예제 #5
0
    def test_positive_update_url(self):
        """Update the original url for a repository

        @id: 1a2cf29b-5c30-4d4c-b6d1-2f227b0a0a57

        @Assert: Repository url is updated
        """
        new_repo = self._make_repository()
        # generate repo URLs with all valid credentials
        auth_repos = [
            repo.format(creds['login'], creds['pass'])
            for creds in valid_http_credentials(url_encoded=True)
            for repo in (FAKE_5_YUM_REPO, FAKE_7_PUPPET_REPO)
        ]

        for url in [
                FAKE_4_YUM_REPO, FAKE_1_PUPPET_REPO, FAKE_2_PUPPET_REPO,
                FAKE_3_PUPPET_REPO, FAKE_2_YUM_REPO
        ] + auth_repos:
            with self.subTest(url):
                # Update the url
                Repository.update({
                    u'id': new_repo['id'],
                    u'url': url,
                })
                # Fetch it again
                result = Repository.info({'id': new_repo['id']})
                self.assertEqual(result['url'], url)
예제 #6
0
    def test_positive_synchronize_auth_yum_repo(self):
        """Check if secured repository can be created and synced

        @id: b0db676b-e0f0-428c-adf3-1d7c0c3599f0

        @Assert: Repository is created and synced

        @CaseLevel: Integration
        """
        url = FAKE_5_YUM_REPO
        for creds in [
                cred for cred in valid_http_credentials(url_encoded=True)
                if cred['http_valid']
        ]:
            url_encoded = url.format(creds['login'], creds['pass'])
            with self.subTest(url):
                new_repo = self._make_repository({
                    u'content-type': u'yum',
                    u'url': url_encoded,
                })
                # Assertion that repo is not yet synced
                self.assertEqual(new_repo['sync']['status'], 'Not Synced')
                # Synchronize it
                Repository.synchronize({'id': new_repo['id']})
                # Verify it has finished
                new_repo = Repository.info({'id': new_repo['id']})
                self.assertEqual(new_repo['sync']['status'], 'Success')
예제 #7
0
    def test_negative_synchronize_auth_yum_repo(self):
        """Check if secured repo fails to synchronize with invalid credentials

        @id: 809905ae-fb76-465d-9468-1f99c4274aeb

        @Assert: Repository is created but synchronization fails

        @CaseLevel: Integration
        """
        url = FAKE_5_YUM_REPO
        for creds in [
                cred for cred in valid_http_credentials(url_encoded=True)
                if not cred['http_valid']
        ]:
            url_encoded = url.format(creds['login'], creds['pass'])
            with self.subTest(url):
                new_repo = self._make_repository({
                    u'content-type': u'yum',
                    u'url': url_encoded,
                })
                # Try to synchronize it
                repo_sync = Repository.synchronize({
                    'id': new_repo['id'],
                    u'async': True
                })
                Task.progress({u'id': repo_sync[0]['id']})
                self.assertEqual(
                    Task.progress({u'id': repo_sync[0]['id']})[0],
                    u'Yum Metadata: Unauthorized')
예제 #8
0
    def test_positive_synchronize_auth_puppet_repo(self):
        """Check if secured puppet repository can be created and synced

        @id: 1d2604fc-8a18-4cbe-bf4c-5c7d9fbdb82c

        @Assert: Repository is created and synced

        @CaseLevel: Integration
        """
        url = FAKE_7_PUPPET_REPO
        for creds in [cred for cred in valid_http_credentials(url_encoded=True)
                      if cred['http_valid']]:
            url_encoded = url.format(creds['login'], creds['pass'])
            with self.subTest(url):
                new_repo = self._make_repository({
                    u'content-type': u'yum',
                    u'url': url_encoded,
                })
                # Assertion that repo is not yet synced
                self.assertEqual(new_repo['sync']['status'], 'Not Synced')
                # Synchronize it
                Repository.synchronize({'id': new_repo['id']})
                # Verify it has finished
                new_repo = Repository.info({'id': new_repo['id']})
                self.assertEqual(new_repo['sync']['status'], 'Success')
예제 #9
0
    def test_negative_synchronize_auth_yum_repo(self):
        """Check if secured repo fails to synchronize with invalid credentials

        @id: 809905ae-fb76-465d-9468-1f99c4274aeb

        @Assert: Repository is created but synchronization fails

        @CaseLevel: Integration
        """
        url = FAKE_5_YUM_REPO
        for creds in [cred for cred in valid_http_credentials(url_encoded=True)
                      if not cred['http_valid']]:
            url_encoded = url.format(
                creds['login'], creds['pass']
            )
            with self.subTest(url):
                new_repo = self._make_repository({
                    u'content-type': u'yum',
                    u'url': url_encoded,
                })
                # Try to synchronize it
                repo_sync = Repository.synchronize(
                    {'id': new_repo['id'], u'async': True}
                )
                Task.progress({u'id': repo_sync[0]['id']})
                self.assertEqual(
                    Task.progress({u'id': repo_sync[0]['id']})[0],
                    u'Yum Metadata: Unauthorized'
                )
예제 #10
0
    def test_positive_update_url(self):
        """Update the original url for a repository

        @id: 1a2cf29b-5c30-4d4c-b6d1-2f227b0a0a57

        @Assert: Repository url is updated
        """
        new_repo = self._make_repository()
        # generate repo URLs with all valid credentials
        auth_repos = [
            repo.format(creds['login'], creds['pass'])
            for creds in valid_http_credentials(url_encoded=True)
            for repo in (FAKE_5_YUM_REPO, FAKE_7_PUPPET_REPO)
        ]

        for url in [FAKE_4_YUM_REPO, FAKE_1_PUPPET_REPO, FAKE_2_PUPPET_REPO,
                    FAKE_3_PUPPET_REPO, FAKE_2_YUM_REPO] + auth_repos:
            with self.subTest(url):
                # Update the url
                Repository.update({
                    u'id': new_repo['id'],
                    u'url': url,
                })
                # Fetch it again
                result = Repository.info({'id': new_repo['id']})
                self.assertEqual(result['url'], url)
예제 #11
0
    def test_negative_update_auth_url_with_special_characters(self):
        """Verify that repository URL credentials cannot be updated to contain
        the forbidden characters

        @id: 566553b2-d077-4fd8-8ed5-00ba75355386

        @Assert: Repository url not updated
        """
        new_repo = self._make_repository()
        # get auth repos with credentials containing unquoted special chars
        auth_repos = [
            repo.format(cred['login'], cred['pass'])
            for cred in valid_http_credentials() if cred['quote']
            for repo in (FAKE_5_YUM_REPO, FAKE_7_PUPPET_REPO)
        ]

        for url in auth_repos:
            with self.subTest(url):
                with self.assertRaises(CLIReturnCodeError):
                    Repository.update({
                        u'id': new_repo['id'],
                        u'url': url,
                    })
                # Fetch it again
                result = Repository.info({'id': new_repo['id']})
                self.assertEqual(result['url'], new_repo['url'])
예제 #12
0
    def test_positive_synchronize_auth_yum_repo(self):
        """Check if secured repository can be created and synced

        @id: bc44881c-e13f-45a9-90c2-5b18c7b25454

        @Assert: Repository is created and synced

        @CaseLevel: Integration
        """
        url = FAKE_5_YUM_REPO
        for creds in [cred for cred in valid_http_credentials(url_encoded=True)
                      if cred['http_valid']]:
            url_encoded = url.format(creds['login'], creds['pass'])
            with self.subTest(url):
                repo = entities.Repository(
                    product=self.product,
                    content_type='yum',
                    url=url_encoded,
                ).create()
                # Assertion that repo is not yet synced
                self.assertEqual(repo.content_counts['rpm'], 0)
                # Synchronize it
                repo.sync()
                # Verify it has finished
                self.assertGreaterEqual(repo.read().content_counts['rpm'], 1)
예제 #13
0
    def test_positive_synchronize_auth_yum_repo(self):
        """Check if secured repository can be created and synced

        @id: bc44881c-e13f-45a9-90c2-5b18c7b25454

        @Assert: Repository is created and synced

        @CaseLevel: Integration
        """
        url = FAKE_5_YUM_REPO
        for creds in [cred for cred in valid_http_credentials(url_encoded=True)
                      if cred['http_valid']]:
            url_encoded = url.format(creds['login'], creds['pass'])
            with self.subTest(url):
                repo = entities.Repository(
                    product=self.product,
                    content_type='yum',
                    url=url_encoded,
                ).create()
                # Assertion that repo is not yet synced
                self.assertEqual(repo.content_counts['rpm'], 0)
                # Synchronize it
                repo.sync()
                # Verify it has finished
                self.assertGreaterEqual(repo.read().content_counts['rpm'], 1)
예제 #14
0
    def test_positive_synchronize_auth_puppet_repo(self):
        """Check if secured puppet repository can be created and synced

        @id: a1e25d36-baae-46cb-aa3b-5cb9fca4f059

        @Assert: Repository is created and synced

        @CaseLevel: Integration
        """
        url = FAKE_7_PUPPET_REPO
        for creds in [cred for cred in valid_http_credentials(url_encoded=True)
                      if cred['http_valid']]:
            url_encoded = url.format(creds['login'], creds['pass'])
            with self.subTest(url):
                repo = entities.Repository(
                    product=self.product,
                    content_type='puppet',
                    url=url_encoded,
                ).create()
                # Assertion that repo is not yet synced
                self.assertEqual(repo.content_counts['puppet_module'], 0)
                # Synchronize it
                repo.sync()
                # Verify it has finished
                self.assertEqual(
                    repo.read().content_counts['puppet_module'], 1)
예제 #15
0
    def test_negative_create_with_auth_url_with_special_characters(self):
        """Verify that repository URL cannot contain unquoted special characters

        @Assert: A repository is not created and error is raised.

        @Feature: HTTP Authentication Repository
        """
        # get a list of valid credentials without quoting them
        for cred in [creds for creds in valid_http_credentials() if creds["quote"] is True]:
            with self.subTest(cred):
                url = FAKE_5_YUM_REPO.format(cred["login"], cred["pass"])
                with self.assertRaises(HTTPError):
                    entities.Repository(url=url).create()
예제 #16
0
    def test_negative_create_with_auth_url_with_special_characters(self):
        """Verify that repository URL cannot contain unquoted special characters

        @id: 2bd5ee17-0fe5-43cb-9cdc-dc2178c5374c

        @Assert: Repository cannot be created
        """
        # get a list of valid credentials without quoting them
        for cred in [creds for creds in valid_http_credentials() if creds["quote"] is True]:
            with self.subTest(cred):
                url = FAKE_5_YUM_REPO.format(cred["login"], cred["pass"])
                with self.assertRaises(CLIFactoryError):
                    self._make_repository({u"url": url})
예제 #17
0
    def test_negative_create_with_auth_url_with_special_characters(self):
        """Verify that repository URL cannot contain unquoted special characters

        @id: 2ffaa412-e5e5-4bec-afaa-9ea54315df49

        @Assert: A repository is not created and error is raised.
        """
        # get a list of valid credentials without quoting them
        for cred in [creds for creds in valid_http_credentials()
                     if creds['quote'] is True]:
            with self.subTest(cred):
                url = FAKE_5_YUM_REPO.format(cred['login'], cred['pass'])
                with self.assertRaises(HTTPError):
                    entities.Repository(url=url).create()
예제 #18
0
    def test_positive_create_with_auth_yum_repo(self):
        """Create yum repository with basic HTTP authentication

        @Assert: yum repository is created

        @Feature: HTTP Authentication Repository
        """
        url = FAKE_5_YUM_REPO
        for creds in valid_http_credentials(url_encoded=True):
            url_encoded = url.format(creds["login"], creds["pass"])
            with self.subTest(url):
                repo = entities.Repository(product=self.product, content_type="yum", url=url_encoded).create()
                self.assertEqual(repo.content_type, "yum")
                self.assertEqual(repo.url, url_encoded)
예제 #19
0
    def test_negative_create_with_auth_url_with_special_characters(self):
        """Verify that repository URL cannot contain unquoted special characters

        @id: 2ffaa412-e5e5-4bec-afaa-9ea54315df49

        @Assert: A repository is not created and error is raised.
        """
        # get a list of valid credentials without quoting them
        for cred in [creds for creds in valid_http_credentials()
                     if creds['quote'] is True]:
            with self.subTest(cred):
                url = FAKE_5_YUM_REPO.format(cred['login'], cred['pass'])
                with self.assertRaises(HTTPError):
                    entities.Repository(url=url).create()
예제 #20
0
    def test_positive_create_with_auth_yum_repo(self):
        """Create YUM repository with basic HTTP authentication

        @id: da8309fd-3076-427b-a96f-8d883d6e944f

        @Assert: YUM repository is created
        """
        url = FAKE_5_YUM_REPO
        for creds in valid_http_credentials(url_encoded=True):
            url_encoded = url.format(creds["login"], creds["pass"])
            with self.subTest(url):
                new_repo = self._make_repository({u"content-type": u"yum", u"url": url_encoded})
                self.assertEqual(new_repo["url"], url_encoded)
                self.assertEqual(new_repo["content-type"], u"yum")
예제 #21
0
    def test_positive_create_with_auth_puppet_repo(self):
        """Create Puppet repository with basic HTTP authentication

        @id: b13f8ae2-60ab-47e6-a096-d3f368e5cab3

        @Assert: Puppet repository is created
        """
        url = FAKE_7_PUPPET_REPO
        for creds in valid_http_credentials(url_encoded=True):
            url_encoded = url.format(creds["login"], creds["pass"])
            with self.subTest(url):
                new_repo = self._make_repository({u"content-type": u"puppet", u"url": url_encoded})
                self.assertEqual(new_repo["url"], url_encoded)
                self.assertEqual(new_repo["content-type"], u"puppet")
예제 #22
0
    def test_negative_create_with_auth_url_with_special_characters(self):
        """Verify that repository URL cannot contain unquoted special characters

        @Feature: Repository

        @Assert: Repository cannot be created
        """
        # get a list of valid credentials without quoting them
        for cred in [creds for creds in valid_http_credentials()
                     if creds['quote'] is True]:
            with self.subTest(cred):
                url = FAKE_5_YUM_REPO.format(cred['login'], cred['pass'])
                with self.assertRaises(CLIFactoryError):
                    self._make_repository({u'url': url})
예제 #23
0
    def test_negative_synchronize_auth_yum_repo(self):
        """Check if secured repo fails to synchronize with invalid credentials

        @Assert: Repository is created but synchronization fails

        @Feature: HTTP Authentication Repository
        """
        url = FAKE_5_YUM_REPO
        for creds in [cred for cred in valid_http_credentials(url_encoded=True) if not cred["http_valid"]]:
            url_encoded = url.format(creds["login"], creds["pass"])
            with self.subTest(url):
                repo = entities.Repository(product=self.product, content_type="yum", url=url_encoded).create()
                # Try to synchronize it
                with self.assertRaises(TaskFailedError):
                    repo.sync()
예제 #24
0
    def test_negative_create_with_auth_url_with_special_characters(self):
        """Verify that repository URL cannot contain unquoted special characters

        @id: 2bd5ee17-0fe5-43cb-9cdc-dc2178c5374c

        @Assert: Repository cannot be created
        """
        # get a list of valid credentials without quoting them
        for cred in [
                creds for creds in valid_http_credentials()
                if creds['quote'] is True
        ]:
            with self.subTest(cred):
                url = FAKE_5_YUM_REPO.format(cred['login'], cred['pass'])
                with self.assertRaises(CLIFactoryError):
                    self._make_repository({u'url': url})
예제 #25
0
    def test_positive_create_with_auth_puppet_repo(self):
        """Create Puppet repository with basic HTTP authentication

        @id: b13f8ae2-60ab-47e6-a096-d3f368e5cab3

        @Assert: Puppet repository is created
        """
        url = FAKE_7_PUPPET_REPO
        for creds in valid_http_credentials(url_encoded=True):
            url_encoded = url.format(creds['login'], creds['pass'])
            with self.subTest(url):
                new_repo = self._make_repository({
                    u'content-type': u'puppet',
                    u'url': url_encoded
                })
                self.assertEqual(new_repo['url'], url_encoded)
                self.assertEqual(new_repo['content-type'], u'puppet')
예제 #26
0
    def test_positive_create_with_auth_puppet_repo(self):
        """Create Puppet repository with basic HTTP authentication

        @Feature: Repository

        @Assert: Puppet repository is created
        """
        url = FAKE_7_PUPPET_REPO
        for creds in valid_http_credentials(url_encoded=True):
            url_encoded = url.format(creds['login'], creds['pass'])
            with self.subTest(url):
                new_repo = self._make_repository({
                    u'content-type': u'puppet',
                    u'url': url_encoded
                })
                self.assertEqual(new_repo['url'], url_encoded)
                self.assertEqual(new_repo['content-type'], u'puppet')
예제 #27
0
    def test_positive_create_with_auth_yum_repo(self):
        """Create YUM repository with basic HTTP authentication

        @id: da8309fd-3076-427b-a96f-8d883d6e944f

        @Assert: YUM repository is created
        """
        url = FAKE_5_YUM_REPO
        for creds in valid_http_credentials(url_encoded=True):
            url_encoded = url.format(creds['login'], creds['pass'])
            with self.subTest(url):
                new_repo = self._make_repository({
                    u'content-type': u'yum',
                    u'url': url_encoded
                })
                self.assertEqual(new_repo['url'], url_encoded)
                self.assertEqual(new_repo['content-type'], u'yum')
예제 #28
0
    def test_positive_synchronize_auth_puppet_repo(self):
        """Check if secured puppet repository can be created and synced

        @Assert: Repository is created and synced

        @Feature: HTTP Authentication Repository
        """
        url = FAKE_7_PUPPET_REPO
        for creds in [cred for cred in valid_http_credentials(url_encoded=True) if cred["http_valid"]]:
            url_encoded = url.format(creds["login"], creds["pass"])
            with self.subTest(url):
                repo = entities.Repository(product=self.product, content_type="puppet", url=url_encoded).create()
                # Assertion that repo is not yet synced
                self.assertEqual(repo.content_counts["puppet_module"], 0)
                # Synchronize it
                repo.sync()
                # Verify it has finished
                self.assertEqual(repo.read().content_counts["puppet_module"], 1)
예제 #29
0
    def test_negative_synchronize_auth_yum_repo(self):
        """Check if secured repo fails to synchronize with invalid credentials

        @id: 809905ae-fb76-465d-9468-1f99c4274aeb

        @Assert: Repository is created but synchronization fails

        @CaseLevel: Integration
        """
        url = FAKE_5_YUM_REPO
        for creds in [cred for cred in valid_http_credentials(url_encoded=True) if not cred["http_valid"]]:
            url_encoded = url.format(creds["login"], creds["pass"])
            with self.subTest(url):
                new_repo = self._make_repository({u"content-type": u"yum", u"url": url_encoded})
                # Try to synchronize it
                repo_sync = Repository.synchronize({"id": new_repo["id"], u"async": True})
                Task.progress({u"id": repo_sync[0]["id"]})
                self.assertEqual(Task.progress({u"id": repo_sync[0]["id"]})[0], u"Yum Metadata: Unauthorized")
예제 #30
0
    def test_positive_create_with_auth_yum_repo(self):
        """Create yum repository with basic HTTP authentication

        @id: 1b17fe37-cdbf-4a79-9b0d-6813ea502754

        @Assert: yum repository is created
        """
        url = FAKE_5_YUM_REPO
        for creds in valid_http_credentials(url_encoded=True):
            url_encoded = url.format(creds['login'], creds['pass'])
            with self.subTest(url):
                repo = entities.Repository(
                    product=self.product,
                    content_type='yum',
                    url=url_encoded,
                ).create()
                self.assertEqual(repo.content_type, 'yum')
                self.assertEqual(repo.url, url_encoded)
예제 #31
0
    def test_positive_create_with_auth_puppet_repo(self):
        """Create Puppet repository with basic HTTP authentication

        @id: af9e4f0f-d128-43d2-a680-0a62c7dab266

        @Assert: Puppet repository is created
        """
        url = FAKE_7_PUPPET_REPO
        for creds in valid_http_credentials(url_encoded=True):
            url_encoded = url.format(creds['login'], creds['pass'])
            with self.subTest(url):
                repo = entities.Repository(
                    product=self.product,
                    content_type='puppet',
                    url=url_encoded,
                ).create()
                self.assertEqual(repo.content_type, 'puppet')
                self.assertEqual(repo.url, url_encoded)
예제 #32
0
    def test_positive_create_with_auth_yum_repo(self):
        """Create yum repository with basic HTTP authentication

        @id: 1b17fe37-cdbf-4a79-9b0d-6813ea502754

        @Assert: yum repository is created
        """
        url = FAKE_5_YUM_REPO
        for creds in valid_http_credentials(url_encoded=True):
            url_encoded = url.format(creds['login'], creds['pass'])
            with self.subTest(url):
                repo = entities.Repository(
                    product=self.product,
                    content_type='yum',
                    url=url_encoded,
                ).create()
                self.assertEqual(repo.content_type, 'yum')
                self.assertEqual(repo.url, url_encoded)
예제 #33
0
    def test_positive_create_with_auth_puppet_repo(self):
        """Create Puppet repository with basic HTTP authentication

        @Assert: Puppet repository is created

        @Feature: HTTP Authentication Repository
        """
        url = FAKE_7_PUPPET_REPO
        for creds in valid_http_credentials(url_encoded=True):
            url_encoded = url.format(creds['login'], creds['pass'])
            with self.subTest(url):
                repo = entities.Repository(
                    product=self.product,
                    content_type='puppet',
                    url=url_encoded,
                ).create()
                self.assertEqual(repo.content_type, 'puppet')
                self.assertEqual(repo.url, url_encoded)
예제 #34
0
    def test_negative_update_auth_url_with_special_characters(self):
        """Verify that repository URL credentials cannot be updated to contain
        the forbidden characters

        @id: 47530b1c-e964-402a-a633-c81583fb5b98

        @Assert: Repository url not updated
        """
        new_repo = entities.Repository(product=self.product).create()
        # get auth repos with credentials containing unquoted special chars
        auth_repos = [
            repo.format(cred['login'], cred['pass'])
            for cred in valid_http_credentials() if cred['quote']
            for repo in (FAKE_5_YUM_REPO, FAKE_7_PUPPET_REPO)
        ]

        for url in auth_repos:
            with self.subTest(url):
                new_repo.url = url
                with self.assertRaises(HTTPError):
                    new_repo = new_repo.update()
예제 #35
0
    def test_positive_synchronize_auth_yum_repo(self):
        """Check if secured repository can be created and synced

        @id: b0db676b-e0f0-428c-adf3-1d7c0c3599f0

        @Assert: Repository is created and synced

        @CaseLevel: Integration
        """
        url = FAKE_5_YUM_REPO
        for creds in [cred for cred in valid_http_credentials(url_encoded=True) if cred["http_valid"]]:
            url_encoded = url.format(creds["login"], creds["pass"])
            with self.subTest(url):
                new_repo = self._make_repository({u"content-type": u"yum", u"url": url_encoded})
                # Assertion that repo is not yet synced
                self.assertEqual(new_repo["sync"]["status"], "Not Synced")
                # Synchronize it
                Repository.synchronize({"id": new_repo["id"]})
                # Verify it has finished
                new_repo = Repository.info({"id": new_repo["id"]})
                self.assertEqual(new_repo["sync"]["status"], "Success")
예제 #36
0
    def test_negative_update_auth_url_with_special_characters(self):
        """Verify that repository URL credentials cannot be updated to contain
        the forbidden characters

        @Assert: Repository url not updated

        @Feature: HTTP Authentication Repository
        """
        new_repo = entities.Repository(product=self.product).create()
        # get auth repos with credentials containing unquoted special chars
        auth_repos = [
            repo.format(cred['login'], cred['pass'])
            for cred in valid_http_credentials() if cred['quote']
            for repo in (FAKE_5_YUM_REPO, FAKE_7_PUPPET_REPO)
        ]

        for url in auth_repos:
            with self.subTest(url):
                new_repo.url = url
                with self.assertRaises(HTTPError):
                    new_repo = new_repo.update()
예제 #37
0
    def test_positive_synchronize_auth_puppet_repo(self):
        """Check if secured puppet repository can be created and synced

        @id: 1d2604fc-8a18-4cbe-bf4c-5c7d9fbdb82c

        @Assert: Repository is created and synced

        @CaseLevel: Integration
        """
        url = FAKE_7_PUPPET_REPO
        for creds in [cred for cred in valid_http_credentials(url_encoded=True) if cred["http_valid"]]:
            url_encoded = url.format(creds["login"], creds["pass"])
            with self.subTest(url):
                new_repo = self._make_repository({u"content-type": u"yum", u"url": url_encoded})
                # Assertion that repo is not yet synced
                self.assertEqual(new_repo["sync"]["status"], "Not Synced")
                # Synchronize it
                Repository.synchronize({"id": new_repo["id"]})
                # Verify it has finished
                new_repo = Repository.info({"id": new_repo["id"]})
                self.assertEqual(new_repo["sync"]["status"], "Success")
예제 #38
0
    def test_negative_synchronize_auth_yum_repo(self):
        """Check if secured repo fails to synchronize with invalid credentials

        @Assert: Repository is created but synchronization fails

        @Feature: HTTP Authentication Repository
        """
        url = FAKE_5_YUM_REPO
        for creds in [
                cred for cred in valid_http_credentials(url_encoded=True)
                if not cred['http_valid']
        ]:
            url_encoded = url.format(creds['login'], creds['pass'])
            with self.subTest(url):
                repo = entities.Repository(
                    product=self.product,
                    content_type='yum',
                    url=url_encoded,
                ).create()
                # Try to synchronize it
                with self.assertRaises(TaskFailedError):
                    repo.sync()
예제 #39
0
    def test_negative_synchronize_auth_yum_repo(self):
        """Check if secured repo fails to synchronize with invalid credentials

        @id: 88361168-69b5-4239-819a-889e316e28dc

        @Assert: Repository is created but synchronization fails

        @CaseLevel: Integration
        """
        url = FAKE_5_YUM_REPO
        for creds in [cred for cred in valid_http_credentials(url_encoded=True)
                      if not cred['http_valid']]:
            url_encoded = url.format(
                creds['login'], creds['pass']
            )
            with self.subTest(url):
                repo = entities.Repository(
                    product=self.product,
                    content_type='yum',
                    url=url_encoded,
                ).create()
                # Try to synchronize it
                with self.assertRaises(TaskFailedError):
                    repo.sync()