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)
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'])
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')
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')
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)
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')
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')
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')
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' )
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)
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)
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()
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})
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()
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)
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")
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")
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})
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()
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})
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')
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')
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')
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)
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")
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)
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)
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)
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()
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")
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()
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")
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()
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()