def test_filtered_datapoint_True(self):
     """Tests if run_one_datapoint=false returns all data points"""
     settings.run_one_datapoint = False
     self.assertEqual(len(generate_strings_list()), 7)
     self.assertEqual(len(invalid_emails_list()), 8)
     self.assertEqual(len(invalid_id_list()), 4)
     self.assertEqual(len(invalid_interfaces_list()), 8)
     self.assertEqual(len(invalid_names_list()), 7)
     self.assertEqual(len(invalid_values_list()), 10)
     self.assertEqual(len(invalid_usernames_list()), 4)
     self.assertEqual(len(valid_labels_list()), 2)
     self.assertEqual(len(valid_data_list()), 7)
     self.assertEqual(len(valid_emails_list()), 8)
     self.assertEqual(len(valid_environments_list()), 4)
     self.assertEqual(len(valid_hosts_list()), 3)
     self.assertEqual(len(valid_hostgroups_list()), 7)
     self.assertEqual(len(valid_interfaces_list()), 3)
     self.assertEqual(len(valid_names_list()), 15)
     self.assertEqual(len(valid_org_names_list()), 7)
     self.assertEqual(len(valid_usernames_list()), 6)
     self.assertEqual(len((valid_cron_expressions())), 4)
     with mock.patch('robottelo.datafactory.bz_bug_is_open',
                     return_value=True):
         self.assertEqual(len(valid_docker_repository_names()), 6)
     with mock.patch('robottelo.datafactory.bz_bug_is_open',
                     return_value=False):
         self.assertEqual(len(valid_docker_repository_names()), 7)
Esempio n. 2
0
 def test_filtered_datapoint_True(self):
     """Tests if run_one_datapoint=false returns all data points"""
     settings.run_one_datapoint = False
     self.assertEqual(len(generate_strings_list()), 7)
     self.assertEqual(len(invalid_emails_list()), 8)
     self.assertEqual(len(invalid_id_list()), 4)
     self.assertEqual(len(invalid_interfaces_list()), 8)
     self.assertEqual(len(invalid_names_list()), 7)
     self.assertEqual(len(invalid_values_list()), 10)
     self.assertEqual(len(invalid_usernames_list()), 4)
     self.assertEqual(len(valid_labels_list()), 2)
     self.assertEqual(len(valid_data_list()), 7)
     self.assertEqual(len(valid_emails_list()), 8)
     self.assertEqual(len(valid_environments_list()), 4)
     self.assertEqual(len(valid_hosts_list()), 3)
     self.assertEqual(len(valid_hostgroups_list()), 7)
     self.assertEqual(len(valid_interfaces_list()), 3)
     self.assertEqual(len(valid_names_list()), 15)
     self.assertEqual(len(valid_org_names_list()), 7)
     self.assertEqual(len(valid_usernames_list()), 6)
     with mock.patch('robottelo.datafactory.bz_bug_is_open',
                     return_value=True):
         self.assertEqual(len(valid_docker_repository_names()), 6)
     with mock.patch('robottelo.datafactory.bz_bug_is_open',
                     return_value=False):
         self.assertEqual(len(valid_docker_repository_names()), 7)
Esempio n. 3
0
    def test_return_type(self):
        """This test validates return types for functions:

        1. :meth:`robottelo.datafactory.generate_strings_list`
        2. :meth:`robottelo.datafactory.invalid_emails_list`
        3. :meth:`robottelo.datafactory.invalid_names_list`
        4. :meth:`robottelo.datafactory.valid_data_list`
        5. :meth:`robottelo.datafactory.valid_emails_list`
        6. :meth:`robottelo.datafactory.valid_environments_list`
        7. :meth:`robottelo.datafactory.valid_labels_list`
        8. :meth:`robottelo.datafactory.valid_names_list`
        9. :meth:`robottelo.datafactory.valid_usernames_list`
        10. :meth:`robottelo.datafactory.invalid_id_list`

        """
        for item in itertools.chain(
                generate_strings_list(),
                invalid_emails_list(),
                invalid_names_list(),
                valid_data_list(),
                valid_emails_list(),
                valid_environments_list(),
                valid_labels_list(),
                valid_names_list(),
                valid_usernames_list(),):
            self.assertIsInstance(item, six.text_type)
        for item in invalid_id_list():
            if not (isinstance(item, (six.text_type, int)) or item is None):
                self.fail('Unexpected data type')
Esempio n. 4
0
 def test_filtered_datapoint(self, run_one_datapoint):
     """Tests if run_one_datapoint=false returns all data points"""
     if run_one_datapoint:
         assert len(datafactory.generate_strings_list()) == 1
         assert len(datafactory.invalid_emails_list()) == 1
         assert len(datafactory.invalid_environments_list()) == 1
         assert len(datafactory.invalid_id_list()) == 1
         assert len(datafactory.invalid_interfaces_list()) == 1
         assert len(datafactory.invalid_names_list()) == 1
         assert len(datafactory.invalid_values_list()) == 1
         assert len(datafactory.valid_data_list()) == 1
         assert len(datafactory.valid_docker_repository_names()) == 1
         assert len(datafactory.valid_emails_list()) == 1
         assert len(datafactory.valid_environments_list()) == 1
         assert len(datafactory.valid_hosts_list()) == 1
         assert len(datafactory.valid_hostgroups_list()) == 1
         assert len(datafactory.valid_interfaces_list()) == 1
         assert len(datafactory.valid_labels_list()) == 1
         assert len(datafactory.valid_names_list()) == 1
         assert len(datafactory.valid_org_names_list()) == 1
         assert len(datafactory.valid_usernames_list()) == 1
         assert len(datafactory.valid_cron_expressions()) == 1
     else:
         assert len(datafactory.generate_strings_list()) == 7
         assert len(datafactory.invalid_emails_list()) == 8
         assert len(datafactory.invalid_environments_list()) == 4
         assert len(datafactory.invalid_id_list()) == 4
         assert len(datafactory.invalid_interfaces_list()) == 8
         assert len(datafactory.invalid_names_list()) == 7
         assert len(datafactory.invalid_values_list()) == 10
         assert len(datafactory.invalid_usernames_list()) == 4
         assert len(datafactory.valid_labels_list()) == 2
         assert len(datafactory.valid_data_list()) == 7
         assert len(datafactory.valid_emails_list()) == 8
         assert len(datafactory.valid_environments_list()) == 4
         assert len(datafactory.valid_hosts_list()) == 3
         assert len(datafactory.valid_hostgroups_list()) == 7
         assert len(datafactory.valid_interfaces_list()) == 3
         assert len(datafactory.valid_names_list()) == 15
         assert len(datafactory.valid_org_names_list()) == 7
         assert len(datafactory.valid_usernames_list()) == 6
         assert len(datafactory.valid_cron_expressions()) == 4
         assert len(datafactory.valid_docker_repository_names()) == 7
Esempio n. 5
0
    def test_negative_delete_by_id(self):
        """Create Domain then delete it by wrong ID

        @id: 0e4ef107-f006-4433-abc3-f872613e0b91

        @assert: Domain is not deleted
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError):
                    Domain.delete({'id': entity_id})
Esempio n. 6
0
    def test_negative_delete_by_id(self):
        """Create Model then delete it by wrong ID

        @id: f8b0d428-1b3d-4fc9-9ca1-1eb30c8ac20a

        @assert: Model is not deleted
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError):
                    Model.delete({'id': entity_id})
Esempio n. 7
0
    def test_negative_delete(self):
        """@test: Create HostGroup then delete it by wrong ID

        @feature: HostGroup

        @assert: HostGroup is not deleted
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError):
                    HostGroup.delete({"id": entity_id})
Esempio n. 8
0
    def test_negative_delete_by_id(self):
        """Create Environment then delete it by wrong ID

        @id: fe77920c-62fd-4e0e-b960-a940a1370d10

        @assert: Environment is not deleted
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError):
                    Environment.delete({'id': entity_id})
Esempio n. 9
0
    def test_negative_delete_by_id(self):
        """Create HostGroup then delete it by wrong ID

        @id: 047c9f1a-4dd6-4fdc-b7ed-37cc725c68d3

        @assert: HostGroup is not deleted
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError):
                    HostGroup.delete({'id': entity_id})
Esempio n. 10
0
    def test_negative_delete_by_id(self):
        """Create Architecture then delete it by wrong ID

        @feature: Architecture

        @assert: Architecture is not deleted
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError):
                    Architecture.delete({'id': entity_id})
Esempio n. 11
0
    def test_negative_delete_by_id(self):
        """Create HostGroup then delete it by wrong ID

        @feature: HostGroup

        @assert: HostGroup is not deleted
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError):
                    HostGroup.delete({'id': entity_id})
Esempio n. 12
0
    def test_negative_delete_by_id(self):
        """Create Architecture then delete it by wrong ID

        @feature: Architecture

        @assert: Architecture is not deleted
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError):
                    Architecture.delete({'id': entity_id})
Esempio n. 13
0
    def test_negative_delete_by_id(self):
        """Create HostGroup then delete it by wrong ID

        @id: 047c9f1a-4dd6-4fdc-b7ed-37cc725c68d3

        @assert: HostGroup is not deleted
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError):
                    HostGroup.delete({'id': entity_id})
Esempio n. 14
0
    def test_negative_delete_by_id(self):
        """Create Environment then delete it by wrong ID

        @feature: Environment

        @assert: Environment is not deleted
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError):
                    Environment.delete({'id': entity_id})
Esempio n. 15
0
    def test_negative_delete_by_id(self):
        """Create Environment then delete it by wrong ID

        @id: fe77920c-62fd-4e0e-b960-a940a1370d10

        @assert: Environment is not deleted
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError):
                    Environment.delete({'id': entity_id})
Esempio n. 16
0
    def test_negative_delete_by_id(self):
        """Create Domain then delete it by wrong ID

        @id: 0e4ef107-f006-4433-abc3-f872613e0b91

        @assert: Domain is not deleted
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError):
                    Domain.delete({'id': entity_id})
Esempio n. 17
0
    def test_negative_delete(self):
        """@test: Create Domain then delete it by wrong ID

        @feature: Domain

        @assert: Domain is not deleted
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError):
                    Domain.delete({'id': entity_id})
Esempio n. 18
0
    def test_negative_delete_by_id(self):
        """Create Architecture then delete it by wrong ID

        @id: 78bae664-6493-4c74-a587-94170f20746e

        @assert: Architecture is not deleted
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError):
                    Architecture.delete({'id': entity_id})
Esempio n. 19
0
    def test_negative_delete_by_id(self):
        """Create HostGroup then delete it by wrong ID

        :id: 047c9f1a-4dd6-4fdc-b7ed-37cc725c68d3

        :expectedresults: HostGroup is not deleted

        :CaseLevel: Integration
        """
        entity_id = invalid_id_list()[0]
        with self.assertRaises(CLIReturnCodeError):
            HostGroup.delete({'id': entity_id})
Esempio n. 20
0
    def test_negative_delete_by_id(self):
        """Create Model then delete it by wrong ID

        :id: f8b0d428-1b3d-4fc9-9ca1-1eb30c8ac20a

        :expectedresults: Model is not deleted

        :CaseImportance: Critical
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError):
                    Model.delete({'id': entity_id})
Esempio n. 21
0
    def test_negative_delete_by_id(self):
        """Create Model then delete it by wrong ID

        :id: f8b0d428-1b3d-4fc9-9ca1-1eb30c8ac20a

        :expectedresults: Model is not deleted

        :CaseImportance: Critical
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError):
                    Model.delete({'id': entity_id})
Esempio n. 22
0
    def test_negative_delete_by_id(self):
        """Create Domain then delete it by wrong ID

        :id: 0e4ef107-f006-4433-abc3-f872613e0b91

        :expectedresults: Domain is not deleted

        :CaseImportance: Critical
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError):
                    Domain.delete({'id': entity_id})
Esempio n. 23
0
    def test_negative_delete_by_id(self):
        """Create Environment then delete it by wrong ID

        :id: fe77920c-62fd-4e0e-b960-a940a1370d10

        :expectedresults: Environment is not deleted

        :CaseImportance: Critical
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError):
                    Environment.delete({'id': entity_id})
Esempio n. 24
0
    def test_negative_delete_by_id(self):
        """Create HostGroup then delete it by wrong ID

        :id: 047c9f1a-4dd6-4fdc-b7ed-37cc725c68d3

        :expectedresults: HostGroup is not deleted

        :CaseImportance: Critical
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError):
                    HostGroup.delete({'id': entity_id})
Esempio n. 25
0
    def test_negative_delete_by_id(self):
        """Create Architecture then delete it by wrong ID

        @id: 78bae664-6493-4c74-a587-94170f20746e

        @assert: Architecture is not deleted
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError) as raise_ctx:
                    Architecture.delete({'id': entity_id})
                self.assert_error_msg(raise_ctx,
                                      "Could not delete the architecture")
Esempio n. 26
0
    def test_negative_delete_by_id(self):
        """Create Environment then delete it by wrong ID

        :id: fe77920c-62fd-4e0e-b960-a940a1370d10

        :expectedresults: Environment is not deleted

        :CaseImportance: Medium
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError):
                    Environment.delete({'id': entity_id})
Esempio n. 27
0
    def test_negative_delete_by_id(self):
        """Create Domain then delete it by wrong ID

        :id: 0e4ef107-f006-4433-abc3-f872613e0b91

        :expectedresults: Domain is not deleted

        :CaseImportance: Critical
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError):
                    Domain.delete({'id': entity_id})
Esempio n. 28
0
    def test_negative_delete_by_id(self):
        """Create HostGroup then delete it by wrong ID

        :id: 047c9f1a-4dd6-4fdc-b7ed-37cc725c68d3

        :expectedresults: HostGroup is not deleted

        :CaseImportance: Critical
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError):
                    HostGroup.delete({'id': entity_id})
Esempio n. 29
0
 def test_datacheck_True(self):
     """Tests if run_one_datapoint=false returns all data points"""
     settings.run_one_datapoint = False
     self.assertEqual(len(generate_strings_list()), 7)
     self.assertEqual(len(invalid_id_list()), 4)
     self.assertEqual(len(invalid_emails_list()), 10)
     self.assertEqual(len(invalid_names_list()), 7)
     self.assertEqual(len(invalid_values_list()), 10)
     self.assertEqual(len(valid_labels_list()), 2)
     self.assertEqual(len(valid_data_list()), 7)
     self.assertEqual(len(valid_emails_list()), 8)
     self.assertEqual(len(valid_environments_list()), 3)
     self.assertEqual(len(valid_names_list()), 15)
     self.assertEqual(len(valid_usernames_list()), 4)
Esempio n. 30
0
 def test_datacheck_False(self):
     """Tests if run_one_datapoint=True returns one data point"""
     settings.run_one_datapoint = True
     self.assertEqual(len(generate_strings_list()), 1)
     self.assertEqual(len(invalid_emails_list()), 1)
     self.assertEqual(len(invalid_id_list()), 1)
     self.assertEqual(len(invalid_names_list()), 1)
     self.assertEqual(len(invalid_values_list()), 1)
     self.assertEqual(len(valid_data_list()), 1)
     self.assertEqual(len(valid_emails_list()), 1)
     self.assertEqual(len(valid_environments_list()), 1)
     self.assertEqual(len(valid_labels_list()), 1)
     self.assertEqual(len(valid_names_list()), 1)
     self.assertEqual(len(valid_usernames_list()), 1)
Esempio n. 31
0
    def test_negative_delete_by_id(self):
        """Create Architecture then delete it by wrong ID

        :id: 78bae664-6493-4c74-a587-94170f20746e

        :expectedresults: Architecture is not deleted

        :CaseImportance: Critical
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError) as raise_ctx:
                    Architecture.delete({'id': entity_id})
                self.assert_error_msg(raise_ctx,
                                      "Could not delete the architecture")
Esempio n. 32
0
    def test_return_type(self):
        """This test validates return types for functions:

        1. :meth:`robottelo.datafactory.generate_strings_list`
        2. :meth:`robottelo.datafactory.invalid_emails_list`
        3. :meth:`robottelo.datafactory.invalid_names_list`
        4. :meth:`robottelo.datafactory.valid_data_list`
        5. :meth:`robottelo.datafactory.valid_docker_repository_names`
        6. :meth:`robottelo.datafactory.valid_emails_list`
        7. :meth:`robottelo.datafactory.valid_environments_list`
        8. :meth:`robottelo.datafactory.valid_hosts_list`
        9. :meth:`robottelo.datafactory.valid_hostgroups_list`
        10. :meth:`robottelo.datafactory.valid_labels_list`
        11. :meth:`robottelo.datafactory.valid_names_list`
        12. :meth:`robottelo.datafactory.valid_org_names_list`
        13. :meth:`robottelo.datafactory.valid_usernames_list`
        14. :meth:`robottelo.datafactory.invalid_id_list`
        15. :meth:`robottelo.datafactory.invalid_interfaces_list`
        16. :meth:`robottelo.datafactory.valid_interfaces_list`
        17. :meth:`robottelo.datafactory.valid_cron_expressions`

        """
        with mock.patch('robottelo.datafactory.bz_bug_is_open',
                        return_value=False):
            for item in itertools.chain(
                    generate_strings_list(),
                    invalid_emails_list(),
                    invalid_interfaces_list(),
                    invalid_names_list(),
                    valid_data_list(),
                    valid_docker_repository_names(),
                    valid_emails_list(),
                    valid_environments_list(),
                    valid_hosts_list(),
                    valid_hostgroups_list(),
                    valid_interfaces_list(),
                    valid_labels_list(),
                    valid_names_list(),
                    valid_org_names_list(),
                    valid_cron_expressions(),
                    valid_usernames_list()):
                self.assertIsInstance(item, six.text_type)
            for item in invalid_id_list():
                if not (
                        isinstance(item, (six.text_type, int)) or item is None
                        ):
                    self.fail('Unexpected data type')
Esempio n. 33
0
 def test_filtered_datapoint_False(self):
     """Tests if run_one_datapoint=True returns one data point"""
     settings.run_one_datapoint = True
     self.assertEqual(len(generate_strings_list()), 1)
     self.assertEqual(len(invalid_emails_list()), 1)
     self.assertEqual(len(invalid_id_list()), 1)
     self.assertEqual(len(invalid_names_list()), 1)
     self.assertEqual(len(invalid_values_list()), 1)
     self.assertEqual(len(valid_data_list()), 1)
     self.assertEqual(len(valid_emails_list()), 1)
     self.assertEqual(len(valid_environments_list()), 1)
     self.assertEqual(len(valid_hosts_list()), 1)
     self.assertEqual(len(valid_hostgroups_list()), 1)
     self.assertEqual(len(valid_labels_list()), 1)
     self.assertEqual(len(valid_names_list()), 1)
     self.assertEqual(len(valid_org_names_list()), 1)
     self.assertEqual(len(valid_usernames_list()), 1)
Esempio n. 34
0
    def test_return_type(self):
        """This test validates return types for functions:

        1. :meth:`robottelo.datafactory.generate_strings_list`
        2. :meth:`robottelo.datafactory.invalid_emails_list`
        3. :meth:`robottelo.datafactory.invalid_environments_list`
        4. :meth:`robottelo.datafactory.invalid_names_list`
        5. :meth:`robottelo.datafactory.valid_data_list`
        6. :meth:`robottelo.datafactory.valid_docker_repository_names`
        7. :meth:`robottelo.datafactory.valid_emails_list`
        8. :meth:`robottelo.datafactory.valid_environments_list`
        9. :meth:`robottelo.datafactory.valid_hosts_list`
        10. :meth:`robottelo.datafactory.valid_hostgroups_list`
        11. :meth:`robottelo.datafactory.valid_labels_list`
        12. :meth:`robottelo.datafactory.valid_names_list`
        13. :meth:`robottelo.datafactory.valid_org_names_list`
        14. :meth:`robottelo.datafactory.valid_usernames_list`
        15. :meth:`robottelo.datafactory.invalid_id_list`
        16. :meth:`robottelo.datafactory.invalid_interfaces_list`
        17. :meth:`robottelo.datafactory.valid_interfaces_list`
        18. :meth:`robottelo.datafactory.valid_cron_expressions`

        """
        for item in itertools.chain(
                datafactory.generate_strings_list(),
                datafactory.invalid_emails_list(),
                datafactory.invalid_environments_list(),
                datafactory.invalid_interfaces_list(),
                datafactory.invalid_names_list(),
                datafactory.valid_data_list(),
                datafactory.valid_docker_repository_names(),
                datafactory.valid_emails_list(),
                datafactory.valid_environments_list(),
                datafactory.valid_hosts_list(),
                datafactory.valid_hostgroups_list(),
                datafactory.valid_interfaces_list(),
                datafactory.valid_labels_list(),
                datafactory.valid_names_list(),
                datafactory.valid_org_names_list(),
                datafactory.valid_cron_expressions(),
                datafactory.valid_usernames_list(),
        ):
            assert isinstance(item, str)
        for item in datafactory.invalid_id_list():
            if not (isinstance(item, (str, int)) or item is None):
                pytest.fail('Unexpected data type')
Esempio n. 35
0
 def test_filtered_datapoint_True(self):
     """Tests if run_one_datapoint=false returns all data points"""
     settings.run_one_datapoint = False
     self.assertEqual(len(generate_strings_list()), 7)
     self.assertEqual(len(invalid_id_list()), 4)
     self.assertEqual(len(invalid_emails_list()), 10)
     self.assertEqual(len(invalid_names_list()), 7)
     self.assertEqual(len(invalid_values_list()), 10)
     self.assertEqual(len(invalid_usernames_list()), 4)
     self.assertEqual(len(valid_labels_list()), 2)
     self.assertEqual(len(valid_data_list()), 7)
     self.assertEqual(len(valid_emails_list()), 8)
     self.assertEqual(len(valid_environments_list()), 3)
     self.assertEqual(len(valid_hosts_list()), 3)
     self.assertEqual(len(valid_hostgroups_list()), 7)
     self.assertEqual(len(valid_names_list()), 15)
     self.assertEqual(len(valid_org_names_list()), 7)
     self.assertEqual(len(valid_usernames_list()), 6)
Esempio n. 36
0
 def test_filtered_datapoint_False(self):
     """Tests if run_one_datapoint=True returns one data point"""
     settings.run_one_datapoint = True
     self.assertEqual(len(generate_strings_list()), 1)
     self.assertEqual(len(invalid_emails_list()), 1)
     self.assertEqual(len(invalid_id_list()), 1)
     self.assertEqual(len(invalid_interfaces_list()), 1)
     self.assertEqual(len(invalid_names_list()), 1)
     self.assertEqual(len(invalid_values_list()), 1)
     self.assertEqual(len(valid_data_list()), 1)
     self.assertEqual(len(valid_docker_repository_names()), 1)
     self.assertEqual(len(valid_emails_list()), 1)
     self.assertEqual(len(valid_environments_list()), 1)
     self.assertEqual(len(valid_hosts_list()), 1)
     self.assertEqual(len(valid_hostgroups_list()), 1)
     self.assertEqual(len(valid_interfaces_list()), 1)
     self.assertEqual(len(valid_labels_list()), 1)
     self.assertEqual(len(valid_names_list()), 1)
     self.assertEqual(len(valid_org_names_list()), 1)
     self.assertEqual(len(valid_usernames_list()), 1)
Esempio n. 37
0
    def test_return_type(self):
        """This test validates return types for functions:

        1. :meth:`robottelo.datafactory.generate_strings_list`
        2. :meth:`robottelo.datafactory.invalid_emails_list`
        3. :meth:`robottelo.datafactory.invalid_names_list`
        4. :meth:`robottelo.datafactory.valid_data_list`
        5. :meth:`robottelo.datafactory.valid_emails_list`
        6. :meth:`robottelo.datafactory.valid_environments_list`
        7. :meth:`robottelo.datafactory.valid_hosts_list`
        8. :meth:`robottelo.datafactory.valid_hostgroups_list`
        9. :meth:`robottelo.datafactory.valid_labels_list`
        10. :meth:`robottelo.datafactory.valid_names_list`
        11. :meth:`robottelo.datafactory.valid_org_names_list`
        12. :meth:`robottelo.datafactory.valid_usernames_list`
        13. :meth:`robottelo.datafactory.invalid_id_list`
        14. :meth:`robottelo.datafactory.invalid_interfaces_list`
        15. :meth:`robottelo.datafactory.valid_interfaces_list`

        """
        for item in itertools.chain(generate_strings_list(),
                                    invalid_emails_list(),
                                    invalid_interfaces_list(),
                                    invalid_names_list(), valid_data_list(),
                                    valid_emails_list(),
                                    valid_environments_list(),
                                    valid_hosts_list(),
                                    valid_hostgroups_list(),
                                    valid_interfaces_list(),
                                    valid_labels_list(), valid_names_list(),
                                    valid_org_names_list(),
                                    valid_usernames_list()):
            self.assertIsInstance(item, six.text_type)
        for item in invalid_id_list():
            if not (isinstance(item, (six.text_type, int)) or item is None):
                self.fail('Unexpected data type')
Esempio n. 38
0
class TestArchitecture:
    """Architecture CLI related tests."""
    @pytest.fixture(scope='class')
    def class_architecture(self):
        """Shared architecture for tests"""
        return make_architecture()

    @tier1
    def test_positive_CRUD(self):
        """Create a new Architecture, update the name and delete the Architecture itself.

        :id: cd8654b8-e603-11ea-adc1-0242ac120002

        :expectedresults: Architecture is created, modified and deleted successfully

        :CaseImportance: Critical
        """

        name = gen_choice(list(valid_data_list().values()))
        new_name = gen_choice(list(valid_data_list().values()))

        architecture = make_architecture({'name': name})
        assert architecture['name'] == name
        Architecture.update({'id': architecture['id'], 'new-name': new_name})
        architecture = Architecture.info({'id': architecture['id']})
        assert architecture['name'] == new_name
        Architecture.delete({'id': architecture['id']})
        with pytest.raises(CLIReturnCodeError):
            Architecture.info({'id': architecture['id']})

    @tier1
    @pytest.mark.parametrize('name', **parametrized(invalid_values_list()))
    def test_negative_create_with_name(self, name):
        """Don't create an Architecture with invalid data.

        :id: cfed972e-9b09-4852-bdd2-b5a8a8aed170

        :parametrized: yes

        :expectedresults: Architecture is not created.

        :CaseImportance: Medium
        """

        with pytest.raises(CLIReturnCodeError) as error:
            Architecture.create({'name': name})

        assert 'Could not create the architecture:' in error.value.message

    @tier1
    @pytest.mark.parametrize('new_name', **parametrized(invalid_values_list()))
    def test_negative_update_name(self, class_architecture, new_name):
        """Create Architecture then fail to update its name

        :id: 037c4892-5e62-46dd-a2ed-92243e870e40

        :parametrized: yes

        :expectedresults: Architecture name is not updated

        :CaseImportance: Medium
        """

        with pytest.raises(CLIReturnCodeError) as error:
            Architecture.update({
                'id': class_architecture['id'],
                'new-name': new_name
            })

        assert 'Could not update the architecture:' in error.value.message

        result = Architecture.info({'id': class_architecture['id']})
        assert class_architecture['name'] == result['name']

    @tier1
    @pytest.mark.parametrize('entity_id', **parametrized(invalid_id_list()))
    def test_negative_delete_by_id(self, entity_id):
        """Delete architecture by invalid ID

        :id: 78bae664-6493-4c74-a587-94170f20746e

        :parametrized: yes

        :expectedresults: Architecture is not deleted

        :CaseImportance: Medium
        """
        with pytest.raises(CLIReturnCodeError) as error:
            Architecture.delete({'id': entity_id})

        assert 'Could not delete the architecture' in error.value.message
Esempio n. 39
0
class TestModel:
    """Test class for Model CLI"""
    @pytest.fixture()
    def class_model(self):
        """Shared model for tests"""
        return make_model()

    @pytest.mark.tier1
    @pytest.mark.upgrade
    @pytest.mark.parametrize('name, new_name',
                             **parametrized(
                                 list(
                                     zip(valid_data_list().values(),
                                         valid_data_list().values()))))
    def test_positive_crud_with_name(self, name, new_name):
        """Successfully creates, updates and deletes a Model.

        :id: 9ca9d5ff-750a-4d60-91b2-4c4375f0e35f

        :parametrized: yes

        :expectedresults: Model is created, updated and deleted.

        :CaseImportance: High
        """
        model = make_model({'name': name})
        assert model['name'] == name
        Model.update({'id': model['id'], 'new-name': new_name})
        model = Model.info({'id': model['id']})
        assert model['name'] == new_name
        Model.delete({'id': model['id']})
        with pytest.raises(CLIReturnCodeError):
            Model.info({'id': model['id']})

    @pytest.mark.tier1
    def test_positive_create_with_vendor_class(self):
        """Check if Model can be created with specific vendor class

        :id: c36d3490-cd12-4f5f-a453-2ae5d0404496

        :expectedresults: Model is created with specific vendor class

        :CaseImportance: Medium
        """
        vendor_class = gen_string('utf8')
        model = make_model({'vendor-class': vendor_class})
        assert model['vendor-class'] == vendor_class

    @pytest.mark.tier1
    @pytest.mark.parametrize('name', **parametrized(invalid_values_list()))
    def test_negative_create_with_name(self, name):
        """Don't create an Model with invalid data.

        :id: b2eade66-b612-47e7-bfcc-6e363023f498

        :parametrized: yes

        :expectedresults: Model is not created.

        :CaseImportance: High
        """
        with pytest.raises(CLIReturnCodeError):
            Model.create({'name': name})

    @pytest.mark.tier1
    @pytest.mark.parametrize('new_name', **parametrized(invalid_values_list()))
    def test_negative_update_name(self, class_model, new_name):
        """Fail to update shared model name

        :id: 98020a4a-1789-4df3-929c-6c132b57f5a1

        :parametrized: yes

        :expectedresults: Model name is not updated

        :CaseImportance: Medium
        """
        with pytest.raises(CLIReturnCodeError):
            Model.update({'id': class_model['id'], 'new-name': new_name})
        result = Model.info({'id': class_model['id']})
        assert class_model['name'] == result['name']

    @pytest.mark.tier1
    @pytest.mark.parametrize('entity_id', **parametrized(invalid_id_list()))
    def test_negative_delete_by_id(self, entity_id):
        """Delete model by wrong ID

        :id: f8b0d428-1b3d-4fc9-9ca1-1eb30c8ac20a

        :parametrized: yes

        :expectedresults: Model is not deleted

        :CaseImportance: High
        """
        with pytest.raises(CLIReturnCodeError):
            Model.delete({'id': entity_id})
Esempio n. 40
0
    :parametrized: yes

    :expectedresults: Domain parameter is not set

    :CaseImportance: Low
    """
    options['domain-id'] = module_domain.id
    # set parameter
    with pytest.raises(CLIReturnCodeError):
        Domain.set_parameter(options)
    # check - parameter not set
    domain = Domain.info({'id': module_domain.id})
    assert len(domain['parameters']) == 0


@tier2
@pytest.mark.parametrize('entity_id', **parametrized(invalid_id_list()))
def test_negative_delete_by_id(entity_id):
    """Create Domain then delete it by wrong ID

    :id: 0e4ef107-f006-4433-abc3-f872613e0b91

    :parametrized: yes

    :expectedresults: Domain is not deleted

    :CaseImportance: Medium
    """
    with pytest.raises(CLIReturnCodeError):
        Domain.delete({'id': entity_id})