def test_register_and_find(self): ''' Test that License classes can be registered with id ''' class FooLicense(base.License): id = 'FOO' license.register(FooLicense) assert license.find('FOO') == FooLicense
def test_register_no_id(self): ''' Test that License classes cannot be registered without id ''' class FooLicense(base.License): pass with pytest.raises(AttributeError): license.register(FooLicense)
def test_register_find_custom_license(self): ''' Test that custom license can be registered and found ''' try: license.register(self.custom_cls) assert license.find('CUSTOM') == self.custom_cls finally: # unregister, just in case try: del license.core._db['CUSTOM'] except: pass