def setUp(self): super(FacadeCheckerTest, self).setUp() factory = FluidinfoSessionFactory('API-9000') transact = Transact(self.threadPool) createSystemData() self.checker = FacadeChecker() self.checker.facadeClient = Facade(transact, factory)
def setUp(self): super(SecureRecentActivityAPIWithUserRoleTest, self).setUp() createSystemData() UserAPI().create([(u'user', u'secret', u'User', u'*****@*****.**')]) self.user = getUser(u'user') self.recentActivity = SecureRecentActivityAPI(self.user) self.permissions = CachingPermissionAPI(self.user)
def testCreateUsers(self): """L{createSystemData} creates all the system L{User}s needed.""" createSystemData() self.assertUser(u'fluiddb', u'FluidDB administrator', u'*****@*****.**', Role.SUPERUSER) self.assertUser(u'anon', u'FluidDB anonymous user', u'*****@*****.**', Role.ANONYMOUS)
def testCreateUsers(self): """L{createSystemData} creates all the system L{User}s needed.""" createSystemData() self.assertUser(u'fluiddb', u'FluidDB administrator', u'*****@*****.**', Role.SUPERUSER) self.assertUser(u'anon', u'FluidDB anonymous user', u'*****@*****.**', Role.ANONYMOUS)
def setUp(self): super(SecureRecentActivityAPIWithUserRoleTest, self).setUp() createSystemData() UserAPI().create([(u'user', u'secret', u'User', u'*****@*****.**')]) self.user = getUser(u'user') self.recentActivity = SecureRecentActivityAPI(self.user) self.permissions = CachingPermissionAPI(self.user)
def testCheckIntegrityChecksErrorInAllRows(self): """ L{checkIntegrity} should check for integrity errors in L{Namespace}s, L{Tag}s, L{User}s, L{AboutTagValue}s and L{TagValue}s. """ createSystemData() [(userObjectID, _)] = UserAPI().create([(u'user', u'pass', u'Name', u'*****@*****.**')]) user = getUser(u'user') result = NamespaceAPI(user).create([(u'user/namespace', u'description') ]) [(namespaceObjectID, _)] = result [(tagObjectID, _)] = TagAPI(user).create([(u'user/tag', u'description') ]) objectID1 = uuid4() objectID2 = uuid4() createAboutTagValue(objectID1, u'Bad about tag') TagValueAPI(user).set({objectID2: {u'fluiddb/about': 'about value'}}) TagValueAPI(user).delete([(userObjectID, u'fluiddb/users/username')]) TagValueAPI(user).delete([(namespaceObjectID, u'fluiddb/namespaces/path')]) TagValueAPI(user).delete([(tagObjectID, u'fluiddb/tags/description')]) checkIntegrity() self.assertEqual( "Integrity Error in namespace u'user/namespace': " 'Path tag is missing.\n' "Integrity Error in tag u'user/tag': Description tag is missing.\n" "Integrity Error in user u'user': Username tag is missing.\n" "Integrity Error in object %s: AboutTagValue doesn't have an " 'associated TagValue.\n' "Integrity Error in object %s: fluiddb/about TagValue doesn't " 'have an associated AboutTagValue.\n' % (objectID1, objectID2), self.log.getvalue())
def testCreateFluidinfoUser(self): """L{bootstrapWebAdminData} creates a C{fluidinfo.com} user.""" createSystemData() bootstrapWebAdminData() webuser = getUser(u'fluidinfo.com') self.assertNotIdentical(None, webuser) self.assertEqual(u'Fluidinfo website', webuser.fullname) self.assertEqual(Role.USER_MANAGER, webuser.role)
def setUp(self): super(SecurePermissionAPIWithNormalUserTest, self).setUp() createSystemData() UserAPI().create([(u'username', u'password', u'User', u'*****@*****.**')]) user = getUser(u'username') TagAPI(user).create([(u'username/tag', u'description')]) self.permissions = SecurePermissionAPI(user)
def setUp(self): super(RootResourceTest, self).setUp() factory = FluidinfoSessionFactory('API-9000') transact = Transact(self.threadPool) createSystemData() self.checker = AnonymousChecker() self.checker.facadeClient = Facade(transact, factory) getConfig().set('service', 'allow-anonymous-access', 'False')
def setUp(self): super(SecureCommentAPIWithUserRoleTest, self).setUp() createSystemData() UserAPI().create([ (u'username', u'password', u'User', u'*****@*****.**'), (u'fluidinfo.com', u'secret', u'Fluidinfo', u'*****@*****.**')]) self.user = getUser(u'username') self.comments = SecureCommentAPI(self.user)
def setUp(self): super(SecureTagAPIWithNormalUserTest, self).setUp() createSystemData() UserAPI().create([(u'user', u'password', u'User', u'*****@*****.**') ]) self.user = getUser(u'user') self.permissions = CachingPermissionAPI(self.user) self.tags = SecureTagAPI(self.user)
def setUp(self): super(DataImportHandlerTest, self).setUp() createSystemData() UserAPI().create([(u'user', u'secret', u'User', u'*****@*****.**')]) self.user = getUser(u'user') self.objects = ObjectAPI(self.user) self.values = TagValueAPI(self.user) self.index = ObjectIndex(self.client)
def setUp(self): super(SecureTagAPIWithNormalUserTest, self).setUp() createSystemData() UserAPI().create([(u'user', u'password', u'User', u'*****@*****.**')]) self.user = getUser(u'user') self.permissions = CachingPermissionAPI(self.user) self.tags = SecureTagAPI(self.user)
def setUp(self): super(RootResourceTest, self).setUp() factory = FluidinfoSessionFactory('API-9000') transact = Transact(self.threadPool) createSystemData() self.checker = AnonymousChecker() self.checker.facadeClient = Facade(transact, factory) getConfig().set('service', 'allow-anonymous-access', 'False')
def setUp(self): super(SecurePermissionAPIWithNormalUserTest, self).setUp() createSystemData() UserAPI().create([(u'username', u'password', u'User', u'*****@*****.**')]) user = getUser(u'username') TagAPI(user).create([(u'username/tag', u'description')]) self.permissions = SecurePermissionAPI(user)
def setUp(self): super(RecentObjectsActivityResourceTest, self).setUp() createSystemData() UserAPI().create([(u'username', u'password', u'User', u'*****@*****.**')]) self.user = getUser(u'username') factory = FluidinfoSessionFactory('API-9000') self.transact = Transact(self.threadPool) self.facade = Facade(self.transact, factory)
def setUp(self): super(SecureObjectAPIWithUserRoleTest, self).setUp() createSystemData() UserAPI().create([(u'username', u'password', u'User', u'*****@*****.**')]) self.user = getUser(u'username') TagAPI(self.user).create([(u'username/tag', u'description')]) self.permissions = CachingPermissionAPI(self.user) self.objects = SecureObjectAPI(self.user)
def setUp(self): super(RecentObjectsActivityResourceTest, self).setUp() createSystemData() UserAPI().create([(u'username', u'password', u'User', u'*****@*****.**')]) self.user = getUser(u'username') factory = FluidinfoSessionFactory('API-9000') self.transact = Transact(self.threadPool) self.facade = Facade(self.transact, factory)
def setUp(self): super(FacadeNamespaceTest, self).setUp() createSystemData() self.transact = Transact(self.threadPool) factory = FluidinfoSessionFactory('API-9000') self.facade = Facade(self.transact, factory) UserAPI().create([(u'username', u'password', u'User', u'*****@*****.**')]) self.user = getUser(u'username') self.permissions = PermissionAPI(self.user)
def testCreateActivationTokenTag(self): """ L{bootstrapWebAdminData} creates a C{fluiddb/users/activation-token} tag. """ createSystemData() bootstrapWebAdminData() superuser = getUser(u'fluiddb') result = TagAPI(superuser).get([u'fluiddb/users/activation-token']) self.assertIn(u'fluiddb/users/activation-token', result)
def setUp(self): super(VerifyUserPasswordResourceTest, self).setUp() self.transact = Transact(self.threadPool) createSystemData() UserAPI().create([ (u'fluidinfo.com', 'secret', u'Fluidinfo', u'*****@*****.**'), (u'user', u'pass', u'Peter Parker', u'*****@*****.**')]) consumer = getUser(u'anon') OAuthConsumerAPI().register(consumer) self.store.commit()
def setUp(self): super(FacadeTagMixinTest, self).setUp() createSystemData() self.transact = Transact(self.threadPool) factory = FluidinfoSessionFactory('API-9000') self.facade = Facade(self.transact, factory) UserAPI().create([(u'username', u'password', u'User', u'*****@*****.**')]) self.user = getUser(u'username') self.permissions = CachingPermissionAPI(self.user)
def setUp(self): super(FacadePermissionTest, self).setUp() self.transact = Transact(FakeThreadPool()) factory = FluidinfoSessionFactory('API-9000') self.facade = Facade(self.transact, factory) createSystemData() UserAPI().create([(u'username', u'password', u'User', u'*****@*****.**')]) user = getUser(u'username') self.permissions = CachingPermissionAPI(user) SecureTagAPI(user).create([(u'username/tag', u'description')])
def setUp(self): super(FluidinfoGlobalTrendingHashtagTest, self).setUp() createSystemData() UserAPI().create([ (u'username', u'password', u'User', u'*****@*****.**'), (u'fluidinfo.com', u'secret', u'Fluidinfo', u'*****@*****.**')]) self.user = getUser(u'username') self.comments = CommentAPI(self.user) objectAPI = ObjectAPI(self.user) self.fluidinfObjectID = objectAPI.create(u'fluidinfo.com') self.tag = u'fluidinfo.com/trending-hashtags'
def setUp(self): super(FluidinfoGlobalTrendingHashtagTest, self).setUp() createSystemData() UserAPI().create([ (u'username', u'password', u'User', u'*****@*****.**'), (u'fluidinfo.com', u'secret', u'Fluidinfo', u'*****@*****.**') ]) self.user = getUser(u'username') self.comments = CommentAPI(self.user) objectAPI = ObjectAPI(self.user) self.fluidinfObjectID = objectAPI.create(u'fluidinfo.com') self.tag = u'fluidinfo.com/trending-hashtags'
def bootstrapSystemData(store): """Create system data in a database. @param store: The C{Store} for the database. """ try: createSystemData() except: transaction.abort() raise else: transaction.commit()
def bootstrapSystemData(store): """Create system data in a database. @param store: The C{Store} for the database. """ try: createSystemData() except: transaction.abort() raise else: transaction.commit()
def testCreateNamespaces(self): """L{createSystemData} creates all the system L{Namespace}s needed.""" createSystemData() self.assertNamespace(u'fluiddb', u"FluidDB admin user's top-level namespace.") self.assertNamespace(u'anon', u"FluidDB anonymous user's top-level namespace.") self.assertNamespace(u'fluiddb/users', u'Holds tags that concern FluidDB users.') self.assertNamespace(u'fluiddb/namespaces', u'Holds information about namespaces.') self.assertNamespace(u'fluiddb/tags', u'Holds information about tags.')
def testCreateTags(self): """L{createSystemData} creates all the system L{Tag}s needed.""" createSystemData() self.assertTag(u'fluiddb/users/username', u"Holds FluidDB users' usernames.") self.assertTag(u'fluiddb/users/name', u"Holds FluidDB users' names.") self.assertTag(u'fluiddb/users/email', u"Holds FluidDB users' email addresses.") self.assertTag(u'fluiddb/namespaces/path', u'The path of a namespace.') self.assertTag(u'fluiddb/namespaces/description', u'Describes a namespace.') self.assertTag(u'fluiddb/tags/path', u'The path of a tag.') self.assertTag(u'fluiddb/tags/description', u'Describes a tag.')
def testCreateNamespaces(self): """L{createSystemData} creates all the system L{Namespace}s needed.""" createSystemData() self.assertNamespace(u'fluiddb', u"FluidDB admin user's top-level namespace.") self.assertNamespace(u'anon', u"FluidDB anonymous user's top-level namespace.") self.assertNamespace(u'fluiddb/users', u'Holds tags that concern FluidDB users.') self.assertNamespace(u'fluiddb/namespaces', u'Holds information about namespaces.') self.assertNamespace(u'fluiddb/tags', u'Holds information about tags.')
def testActivationTokenTagPermission(self): """ L{bootstrapWebAdminData} creates a C{fluiddb/users/activation-token} tag with write permissions for the C{fluidinfo.com} user. """ createSystemData() bootstrapWebAdminData() superuser = getUser(u'fluiddb') pathAndOperation = (u'fluiddb/users/activation-token', Operation.WRITE_TAG_VALUE) result = PermissionAPI(superuser).get([pathAndOperation]) policy, exceptions = result[pathAndOperation] self.assertEqual(Policy.CLOSED, policy) self.assertEqual([u'fluidinfo.com'], exceptions)
def testUser(self): """ The L{AuthenticationPlugin.user} property returns the L{User} instance for the session. """ createSystemData() [(objectID, username)] = UserAPI().create( [(u'user', u'secret', u'User', u'*****@*****.**')]) session = FluidinfoSession('id', self.transact) session.start() try: session.auth.login(username, objectID) finally: session.stop() self.assertEqual(u'user', session.auth.user.username)
def setUp(self): super(FacadeUserMixinTest, self).setUp() self.transact = Transact(self.threadPool) factory = FluidinfoSessionFactory('API-9000') self.facade = Facade(self.transact, factory) system = createSystemData() self.admin = system.users[u'fluiddb']
def setUp(self): super(SecureTagValueAPIWithSuperuserRoleTest, self).setUp() system = createSystemData() self.superuser = system.users[u'fluiddb'] TagAPI(self.superuser).create([(u'fluiddb/tag', u'description')]) self.tagValues = SecureTagValueAPI(self.superuser) self.permissions = CachingPermissionAPI(self.superuser)
def setUp(self): super(DatasetImporterTest, self).setUp() self.system = createSystemData() UserAPI().create([(u'user', u'secret', u'User', u'*****@*****.**')]) user = getUser(u'user') self.objects = SecureObjectAPI(user) self.values = SecureTagValueAPI(user)
def testUser(self): """ The L{AuthenticationPlugin.user} property returns the L{User} instance for the session. """ createSystemData() [(objectID, username)] = UserAPI().create([ (u'user', u'secret', u'User', u'*****@*****.**') ]) session = FluidinfoSession('id', self.transact) session.start() try: session.auth.login(username, objectID) finally: session.stop() self.assertEqual(u'user', session.auth.user.username)
def setUp(self): super(CachingObjectAPITest, self).setUp() self.system = createSystemData() UserAPI().create([(u'user', u'password', u'User', u'*****@*****.**') ]) self.user = getUser(u'user') self.objects = CachingObjectAPI(self.user)
def setUp(self): super(SuperuserPermissionCheckerTest, self).setUp() self.system = createSystemData() UserAPI().create([(u'username', u'password', u'User', u'*****@*****.**')]) self.user = getUser(u'username') self.permissions = PermissionAPI(self.user)
def setUp(self): super(CachingAPIFactoryTest, self).setUp() self.system = createSystemData() CachingUserAPI().create( [(u'user', u'secret', u'User', u'*****@*****.**')]) self.user = cachingGetUser(u'user') self.factory = CachingAPIFactory()
def setUp(self): super(SecurePermissionAPIWithBrokenCacheTest, self).setUp() self.system = createSystemData() UserAPI().create([(u'username', u'password', u'User', u'*****@*****.**')]) self.user = getUser(u'username') self.permissions = SecurePermissionAPI(self.user)
def setUp(self): super(SuperuserPermissionCheckerTest, self).setUp() self.system = createSystemData() UserAPI().create([(u'username', u'password', u'User', u'*****@*****.**')]) self.user = getUser(u'username') self.permissions = PermissionAPI(self.user)
def setUp(self): super(SecureObjectAPIWithBrokenCacheTest, self).setUp() self.system = createSystemData() UserAPI().create([(u'user', u'password', u'User', u'*****@*****.**')]) self.user = getUser(u'user') self.objects = SecureObjectAPI(self.user)
def setUp(self): super(CachingPermissionCheckerAPITest, self).setUp() self.system = createSystemData() UserAPI().create([(u'username', u'password', u'User', u'*****@*****.**')]) self.user = getUser(u'username') self.api = CachingPermissionCheckerAPI()
def setUp(self): super(DatasetImporterTest, self).setUp() self.system = createSystemData() UserAPI().create([(u'user', u'secret', u'User', u'*****@*****.**')]) user = getUser(u'user') self.objects = SecureObjectAPI(user) self.values = SecureTagValueAPI(user)
def setUp(self): super(CachingPermissionCheckerAPITest, self).setUp() self.system = createSystemData() UserAPI().create([(u'username', u'password', u'User', u'*****@*****.**')]) self.user = getUser(u'username') self.api = CachingPermissionCheckerAPI()
def setUp(self): super(CachingPermissionAPIWithBrokenCacheTest, self).setUp() self.system = createSystemData() UserAPI().create([(u'username', u'password', u'User', u'*****@*****.**')]) self.user = getUser(u'username') self.permissions = CachingPermissionAPI(self.user)
def setUp(self): super(SecureRecentActivityAPIWithAnonymousRoleTest, self).setUp() system = createSystemData() self.anon = system.users[u'anon'] UserAPI().create([(u'user', u'secret', u'User', u'*****@*****.**')]) self.user = getUser(u'user') self.recentActivity = SecureRecentActivityAPI(self.anon) self.permissions = CachingPermissionAPI(self.user)
def setUp(self): super(SecureObjectAPIWithSuperuserRoleTest, self).setUp() system = createSystemData() self.superuser = system.users[u'fluiddb'] self.permissions = CachingPermissionAPI(self.superuser) self.objects = SecureObjectAPI(self.superuser) UserAPI().create([(u'username', u'password', u'User', u'*****@*****.**')])
def testCreateTags(self): """L{createSystemData} creates all the system L{Tag}s needed.""" createSystemData() self.assertTag(u'fluiddb/users/username', u"Holds FluidDB users' usernames.") self.assertTag(u'fluiddb/users/name', u"Holds FluidDB users' names.") self.assertTag(u'fluiddb/users/email', u"Holds FluidDB users' email addresses.") self.assertTag(u'fluiddb/namespaces/path', u'The path of a namespace.') self.assertTag(u'fluiddb/namespaces/description', u'Describes a namespace.') self.assertTag(u'fluiddb/tags/path', u'The path of a tag.') self.assertTag(u'fluiddb/tags/description', u'Describes a tag.')
def setUp(self): super(TagValueIntegrityCheckerTest, self).setUp() self.system = createSystemData() self.user = createUser(u'user', u'pass', u'Name', u'*****@*****.**') self.parent = createNamespace(self.user, u'user', None) self.user.namespaceID = self.parent.id self.checker = TagValueIntegrityChecker() self.superuser = self.system.users[u'fluiddb']