Fix tests and test provider for real license format
This commit is contained in:
parent
7f358cb2bd
commit
2eabf1a291
4 changed files with 436 additions and 97 deletions
|
@ -1,21 +1,22 @@
|
|||
import json
|
||||
import io
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from util.config.provider.baseprovider import BaseProvider
|
||||
from util.license import (EntitlementValidationResult, Entitlement, Expiration, ExpirationType,
|
||||
EntitlementRequirement)
|
||||
|
||||
REAL_FILES = ['test/data/signing-private.gpg', 'test/data/signing-public.gpg']
|
||||
|
||||
class TestLicense(object):
|
||||
@property
|
||||
def subscription(self):
|
||||
return {}
|
||||
|
||||
@property
|
||||
def is_expired(self):
|
||||
return False
|
||||
def validate_entitlement_requirement(self, entitlement_req, check_time):
|
||||
expiration = Expiration(ExpirationType.license_wide, datetime.now() + timedelta(days=31))
|
||||
entitlement = Entitlement('fake', 0, 'someprod', expiration)
|
||||
fakereq = EntitlementRequirement('fake', 0)
|
||||
return EntitlementValidationResult(fakereq, datetime.now(), entitlement)
|
||||
|
||||
def validate(self, config):
|
||||
pass
|
||||
return [self.validate_entitlement_requirement(None, None)]
|
||||
|
||||
class TestConfigProvider(BaseProvider):
|
||||
""" Implementation of the config provider for testing. Everything is kept in-memory instead on
|
||||
|
|
Reference in a new issue