コード例 #1
0
    def testGetOrInsert_ExistingUser_AppEngineUser(self):

        user_models.User.get_or_insert(_TEST_EMAIL)
        self.assertEntityCount(user_models.User, 1)

        appengine_user = test_utils.CreateAppEngineUser(email=_TEST_EMAIL)

        user = user_models.User.GetOrInsert(appengine_user=appengine_user)

        self.assertIsNotNone(user)
        self.assertEntityCount(user_models.User, 1)
        self.assertNoBigQueryInsertions()
コード例 #2
0
    def testGetOrInsert_ExistingUser_AppEngineUser(self):

        base.User.get_or_insert(_TEST_EMAIL)
        self.assertEntityCount(base.User, 1)

        appengine_user = test_utils.CreateAppEngineUser(email=_TEST_EMAIL)

        user = base.User.GetOrInsert(appengine_user=appengine_user)

        self.assertIsNotNone(user)
        self.assertEntityCount(base.User, 1)
        self.assertTaskCount(constants.TASK_QUEUE.BQ_PERSISTENCE, 0)
コード例 #3
0
    def testGetOrInsert_NewUser_AppEngineUser(self):

        self.assertEntityCount(user_models.User, 0)

        appengine_user = test_utils.CreateAppEngineUser(email=_TEST_EMAIL)
        user = user_models.User.GetOrInsert(appengine_user=appengine_user)

        self.assertIsNotNone(user)
        self.assertEntityCount(user_models.User, 1)

        self.assertListEqual([constants.USER_ROLE.USER], user.roles)
        self.assertSetEqual(constants.PERMISSIONS.SET_USER, user.permissions)

        self.assertBigQueryInsertion(constants.BIGQUERY_TABLE.USER)
コード例 #4
0
    def testGetOrInsert_NewUser_AppEngineUser(self):

        self.assertEntityCount(base.User, 0)
        self.assertEntityCount(bigquery.UserRow, 0)

        appengine_user = test_utils.CreateAppEngineUser(email=_TEST_EMAIL)
        user = base.User.GetOrInsert(appengine_user=appengine_user)

        self.assertIsNotNone(user)
        self.assertEntityCount(base.User, 1)
        self.assertEntityCount(bigquery.UserRow, 0)

        self.assertListEqual([constants.USER_ROLE.USER], user.roles)
        self.assertSetEqual(constants.PERMISSIONS.SET_USER, user.permissions)

        self.assertTaskCount(constants.TASK_QUEUE.BQ_PERSISTENCE, 1)
        self.DrainTaskQueue(constants.TASK_QUEUE.BQ_PERSISTENCE)
        self.assertTaskCount(constants.TASK_QUEUE.BQ_PERSISTENCE, 0)
        self.assertEntityCount(bigquery.UserRow, 1)