Esempio n. 1
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')
 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. 3
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. 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_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. 6
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. 7
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. 8
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. 9
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. 10
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. 11
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. 12
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')
def global_parameters_valid_names_list():
    """"Return valid names for Global Parameters"""
    # global parameters does not support names with spaces
    return [name.replace(' ', '_') for name in valid_names_list()]
Esempio n. 14
0
def global_parameters_valid_names_list():
    """"Return valid names for Global Parameters"""
    # global parameters does not support names with spaces
    return [name.replace(' ', '_') for name in valid_names_list()]