mirror of
https://github.com/ansible/awx.git
synced 2026-03-01 00:38:45 -03:30
Fix up some issues on feature validation for licenses
Also purging and fixing up some unit test behavior
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
|
|
||||||
# Python
|
# Python
|
||||||
import time
|
|
||||||
import pytest
|
import pytest
|
||||||
import mock
|
import mock
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
|
|||||||
@@ -127,9 +127,6 @@ def test_radius_settings(get, put, patch, delete, admin, settings):
|
|||||||
def test_ui_settings(get, put, patch, delete, admin):
|
def test_ui_settings(get, put, patch, delete, admin):
|
||||||
url = reverse('api:setting_singleton_detail', kwargs={'category_slug': 'ui'})
|
url = reverse('api:setting_singleton_detail', kwargs={'category_slug': 'ui'})
|
||||||
response = get(url, user=admin, expect=200)
|
response = get(url, user=admin, expect=200)
|
||||||
assert 'CUSTOM_LOGO' not in response.data
|
|
||||||
assert 'CUSTOM_LOGIN_INFO' not in response.data
|
|
||||||
response = get(url, user=admin, expect=200)
|
|
||||||
assert not response.data['CUSTOM_LOGO']
|
assert not response.data['CUSTOM_LOGO']
|
||||||
assert not response.data['CUSTOM_LOGIN_INFO']
|
assert not response.data['CUSTOM_LOGIN_INFO']
|
||||||
put(url, user=admin, data=response.data, expect=200)
|
put(url, user=admin, data=response.data, expect=200)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from awx.main.utils.common import StubLicense
|
|||||||
|
|
||||||
|
|
||||||
def test_stub_license():
|
def test_stub_license():
|
||||||
license_actual = StubLicense()
|
license_actual = StubLicense().validate()
|
||||||
assert license_actual['license_key'] == 'OPEN'
|
assert license_actual['license_key'] == 'OPEN'
|
||||||
assert license_actual['valid_key']
|
assert license_actual['valid_key']
|
||||||
assert license_actual['compliant']
|
assert license_actual['compliant']
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
import pytest
|
import pytest
|
||||||
import mock
|
import mock
|
||||||
import os
|
|
||||||
|
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.forms.models import model_to_dict
|
from django.forms.models import model_to_dict
|
||||||
from rest_framework.exceptions import ParseError
|
from rest_framework.exceptions import ParseError
|
||||||
from rest_framework.exceptions import PermissionDenied
|
|
||||||
|
|
||||||
from awx.main.access import (
|
from awx.main.access import (
|
||||||
BaseAccess,
|
BaseAccess,
|
||||||
|
|||||||
@@ -163,10 +163,23 @@ def get_awx_version():
|
|||||||
|
|
||||||
class StubLicense(object):
|
class StubLicense(object):
|
||||||
|
|
||||||
|
features = {
|
||||||
|
'activity_streams': True,
|
||||||
|
'ha': True,
|
||||||
|
'ldap': True,
|
||||||
|
'multiple_organizations': True,
|
||||||
|
'surveys': True,
|
||||||
|
'system_tracking': True,
|
||||||
|
'rebranding': True,
|
||||||
|
'enterprise_auth': True,
|
||||||
|
'workflows': True,
|
||||||
|
}
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
return dict(license_key='OPEN',
|
return dict(license_key='OPEN',
|
||||||
valid_key=True,
|
valid_key=True,
|
||||||
compliant=True,
|
compliant=True,
|
||||||
|
features=self.features,
|
||||||
license_type='open')
|
license_type='open')
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user