本文整理汇总了Python中instance.tests.models.factories.instance.OpenEdXInstanceFactory.reset_ansible_settings方法的典型用法代码示例。如果您正苦于以下问题:Python OpenEdXInstanceFactory.reset_ansible_settings方法的具体用法?Python OpenEdXInstanceFactory.reset_ansible_settings怎么用?Python OpenEdXInstanceFactory.reset_ansible_settings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类instance.tests.models.factories.instance.OpenEdXInstanceFactory
的用法示例。
在下文中一共展示了OpenEdXInstanceFactory.reset_ansible_settings方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_reset_ansible_settings
# 需要导入模块: from instance.tests.models.factories.instance import OpenEdXInstanceFactory [as 别名]
# 或者: from instance.tests.models.factories.instance.OpenEdXInstanceFactory import reset_ansible_settings [as 别名]
def test_reset_ansible_settings(self):
"""
Ansible vars as a string
"""
instance = OpenEdXInstanceFactory(
name='Vars Instance',
sub_domain='vars.test',
email='[email protected]',
github_organization_name='vars-org',
github_repository_name='vars-repo',
commit_id='9' * 40,
ansible_source_repo_url='http://example.org/config/repo',
configuration_version='test-config-ver',
forum_version='test-forum-ver',
notifier_version='test-notif-ver',
xqueue_version='test-xq-ver',
certs_version='test-cert-ver',
)
instance.reset_ansible_settings()
self.assertIn('EDXAPP_PLATFORM_NAME: "Vars Instance"', instance.ansible_settings)
self.assertIn("EDXAPP_SITE_NAME: 'vars.test.example.com", instance.ansible_settings)
self.assertIn("EDXAPP_CMS_SITE_NAME: 'studio.vars.test.example.com'", instance.ansible_settings)
self.assertIn("EDXAPP_CONTACT_EMAIL: '[email protected]'", instance.ansible_settings)
self.assertIn("edx_platform_repo: 'https://github.com/vars-org/vars-repo.git'", instance.ansible_settings)
self.assertIn("edx_platform_version: '{}'".format('9' * 40), instance.ansible_settings)
self.assertIn("edx_ansible_source_repo: 'http://example.org/config/repo'", instance.ansible_settings)
self.assertIn("configuration_version: 'test-config-ver'", instance.ansible_settings)
self.assertIn("forum_version: 'test-forum-ver'", instance.ansible_settings)
self.assertIn("notifier_version: 'test-notif-ver'", instance.ansible_settings)
self.assertIn("xqueue_version: 'test-xq-ver'", instance.ansible_settings)
self.assertIn("certs_version: 'test-cert-ver'", instance.ansible_settings)
示例2: test_ansible_settings_mongo_ephemeral
# 需要导入模块: from instance.tests.models.factories.instance import OpenEdXInstanceFactory [as 别名]
# 或者: from instance.tests.models.factories.instance.OpenEdXInstanceFactory import reset_ansible_settings [as 别名]
def test_ansible_settings_mongo_ephemeral(self):
"""
Don't add mongo ansible vars if INSTANCE_MONGO_URL is not set
"""
instance = OpenEdXInstanceFactory(use_ephemeral_databases=True)
instance.reset_ansible_settings()
self.check_mongo_vars_not_set(instance)
示例3: test_ansible_settings_mysql_ephemeral
# 需要导入模块: from instance.tests.models.factories.instance import OpenEdXInstanceFactory [as 别名]
# 或者: from instance.tests.models.factories.instance.OpenEdXInstanceFactory import reset_ansible_settings [as 别名]
def test_ansible_settings_mysql_ephemeral(self):
"""
Don't add mysql ansible vars for ephemeral databases
"""
instance = OpenEdXInstanceFactory(use_ephemeral_databases=True)
instance.reset_ansible_settings()
self.check_mysql_vars_not_set(instance)
示例4: test_ansible_settings_mysql_not_set
# 需要导入模块: from instance.tests.models.factories.instance import OpenEdXInstanceFactory [as 别名]
# 或者: from instance.tests.models.factories.instance.OpenEdXInstanceFactory import reset_ansible_settings [as 别名]
def test_ansible_settings_mysql_not_set(self):
"""
Don't add mysql ansible vars if INSTANCE_MYSQL_URL is not set
"""
instance = OpenEdXInstanceFactory(use_ephemeral_databases=False)
instance.reset_ansible_settings()
self.check_mysql_vars_not_set(instance)
示例5: test_github_admin_username_list_default
# 需要导入模块: from instance.tests.models.factories.instance import OpenEdXInstanceFactory [as 别名]
# 或者: from instance.tests.models.factories.instance.OpenEdXInstanceFactory import reset_ansible_settings [as 别名]
def test_github_admin_username_list_default(self):
"""
By default, no admin should be configured
"""
instance = OpenEdXInstanceFactory()
instance.reset_ansible_settings()
self.assertEqual(instance.github_admin_organization_name, '')
self.assertEqual(instance.github_admin_username_list, [])
self.assertNotIn('COMMON_USER_INFO', instance.ansible_settings)
示例6: test_github_admin_username_list_with_org_set
# 需要导入模块: from instance.tests.models.factories.instance import OpenEdXInstanceFactory [as 别名]
# 或者: from instance.tests.models.factories.instance.OpenEdXInstanceFactory import reset_ansible_settings [as 别名]
def test_github_admin_username_list_with_org_set(self, mock_get_username_list):
"""
When an admin org is set, its members should be included in the ansible conf
"""
mock_get_username_list.return_value = ['admin1', 'admin2']
instance = OpenEdXInstanceFactory(github_admin_organization_name='test-admin-org')
instance.reset_ansible_settings()
self.assertEqual(instance.github_admin_username_list, ['admin1', 'admin2'])
self.assertIn('COMMON_USER_INFO:\n - name: admin1\n github: true\n type: admin\n'
' - name: admin2\n github: true\n type: admin', instance.ansible_settings)
示例7: test_ansible_extra_settings
# 需要导入模块: from instance.tests.models.factories.instance import OpenEdXInstanceFactory [as 别名]
# 或者: from instance.tests.models.factories.instance.OpenEdXInstanceFactory import reset_ansible_settings [as 别名]
def test_ansible_extra_settings(self):
"""
Add extra settings in ansible vars, which can override existing settings
"""
instance = OpenEdXInstanceFactory(
name='Vars Instance',
email='[email protected]',
ansible_extra_settings='EDXAPP_PLATFORM_NAME: "Overriden!"',
)
instance.reset_ansible_settings()
self.assertIn('EDXAPP_PLATFORM_NAME: Overriden!', instance.ansible_settings)
self.assertNotIn('Vars Instance', instance.ansible_settings)
self.assertIn("EDXAPP_CONTACT_EMAIL: [email protected]", instance.ansible_settings)
示例8: test_ansible_settings_mysql
# 需要导入模块: from instance.tests.models.factories.instance import OpenEdXInstanceFactory [as 别名]
# 或者: from instance.tests.models.factories.instance.OpenEdXInstanceFactory import reset_ansible_settings [as 别名]
def test_ansible_settings_mysql(self):
"""
Add mysql ansible vars if INSTANCE_MYSQL_URL is set
"""
instance = OpenEdXInstanceFactory(use_ephemeral_databases=False)
instance.reset_ansible_settings()
self.assertIn('EDXAPP_MYSQL_USER: {0}'.format(instance.mysql_user), instance.ansible_settings)
self.assertIn('EDXAPP_MYSQL_PASSWORD: {0}'.format(instance.mysql_pass), instance.ansible_settings)
self.assertIn('EDXAPP_MYSQL_HOST: mysql.opencraft.com', instance.ansible_settings)
self.assertIn('EDXAPP_MYSQL_PORT: 3306', instance.ansible_settings)
self.assertIn('EDXAPP_MYSQL_DB_NAME: {0}'.format(instance.mysql_database_name), instance.ansible_settings)
self.assertIn('COMMON_MYSQL_MIGRATE_USER: {0}'.format(instance.mysql_user), instance.ansible_settings)
self.assertIn('COMMON_MYSQL_MIGRATE_PASS: {0}'.format(instance.mysql_pass), instance.ansible_settings)
示例9: test_ansible_settings_mongo
# 需要导入模块: from instance.tests.models.factories.instance import OpenEdXInstanceFactory [as 别名]
# 或者: from instance.tests.models.factories.instance.OpenEdXInstanceFactory import reset_ansible_settings [as 别名]
def test_ansible_settings_mongo(self):
"""
Add mongo ansible vars if INSTANCE_MONGO_URL is set
"""
instance = OpenEdXInstanceFactory(use_ephemeral_databases=False)
instance.reset_ansible_settings()
self.assertIn('EDXAPP_MONGO_USER: {0}'.format(instance.mongo_user), instance.ansible_settings)
self.assertIn('EDXAPP_MONGO_PASSWORD: {0}'.format(instance.mongo_pass), instance.ansible_settings)
self.assertIn('EDXAPP_MONGO_HOSTS: [mongo.opencraft.com]', instance.ansible_settings)
self.assertIn('EDXAPP_MONGO_PORT: 27017', instance.ansible_settings)
self.assertIn('EDXAPP_MONGO_DB_NAME: {0}'.format(instance.mongo_database_name), instance.ansible_settings)
self.assertIn('FORUM_MONGO_USER: {0}'.format(instance.mongo_user), instance.ansible_settings)
self.assertIn('FORUM_MONGO_PASSWORD: {0}'.format(instance.mongo_pass), instance.ansible_settings)
self.assertIn('FORUM_MONGO_HOSTS: [mongo.opencraft.com]', instance.ansible_settings)
self.assertIn('FORUM_MONGO_PORT: 27017', instance.ansible_settings)
self.assertIn('FORUM_MONGO_DATABASE: {0}'.format(instance.forum_database_name), instance.ansible_settings)
示例10: test_ansible_s3_settings
# 需要导入模块: from instance.tests.models.factories.instance import OpenEdXInstanceFactory [as 别名]
# 或者: from instance.tests.models.factories.instance.OpenEdXInstanceFactory import reset_ansible_settings [as 别名]
def test_ansible_s3_settings(self):
"""
Add extra settings in ansible vars, which can override existing settings
"""
instance = OpenEdXInstanceFactory(
s3_access_key='test-s3-access-key',
s3_secret_access_key='test-s3-secret-access-key',
s3_bucket_name='test-s3-bucket-name',
)
instance.reset_ansible_settings()
self.assertIn('AWS_ACCESS_KEY_ID: test-s3-access-key', instance.ansible_settings)
self.assertIn('AWS_SECRET_ACCESS_KEY: test-s3-secret-access-key', instance.ansible_settings)
self.assertIn('EDXAPP_AUTH_EXTRA: {AWS_STORAGE_BUCKET_NAME: test-s3-bucket-name}', instance.ansible_settings)
self.assertIn('EDXAPP_AWS_ACCESS_KEY_ID: test-s3-access-key', instance.ansible_settings)
self.assertIn('EDXAPP_AWS_SECRET_ACCESS_KEY: test-s3-secret-access-key', instance.ansible_settings)
self.assertIn('XQUEUE_AWS_ACCESS_KEY_ID: test-s3-access-key', instance.ansible_settings)
self.assertIn('XQUEUE_AWS_SECRET_ACCESS_KEY: test-s3-secret-access-key', instance.ansible_settings)
self.assertIn('XQUEUE_S3_BUCKET: test-s3-bucket-name', instance.ansible_settings)