• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python api.get_user函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中myuw.test.api.get_user函数的典型用法代码示例。如果您正苦于以下问题:Python get_user函数的具体用法?Python get_user怎么用?Python get_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_user函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_javerage_current_term

    def test_javerage_current_term(self):
        url = reverse("myuw_current_schedule")
        get_user('javerage')
        self.client.login(username='javerage',
                          password=get_user_pass('javerage'))
        response = self.client.get(url)
        self.assertEquals(response.status_code, 200)

        data = json.loads(response.content)

        self.assertEquals(data["term"]["year"], 2013)
        self.assertEquals(data["term"]["quarter"], 'Spring')
        self.assertEquals(len(data["sections"]), 5)
        for section in data["sections"]:
            if section["curriculum_abbr"] == "PHYS" and\
                    section["course_number"] == "121" and\
                    section["section_id"] == "A":
                self.assertEquals(section["canvas_url"],
                                  "https://canvas.uw.edu/courses/249652")
                self.assertEquals(section["canvas_name"],
                                  "MECHANICS")

            if section["curriculum_abbr"] == "TRAIN" and\
                    section["course_number"] == "100" and\
                    section["section_id"] == "A":
                self.assertRaises(KeyError, section.get("canvas_url"))
开发者ID:mattventura,项目名称:myuw,代码行数:26,代码来源:schedule.py


示例2: test_past_quarter

    def test_past_quarter(self):
        url = reverse("myuw_future_schedule_api",
                      kwargs={'year': 2013,
                              'quarter': 'winter'})
        get_user('javerage')
        self.client.login(username='javerage',
                          password=get_user_pass('javerage'))
        response = self.client.get(url)
        self.assertEquals(response.status_code, 410)

#        session = self.client.session
#        session["myuw_override_date"] = "2013-03-26"
#        session.save()
#        response = self.client.get(url)
#        self.assertEquals(response.status_code, 410)

        session = self.client.session
        session["myuw_override_date"] = "2013-03-27"
        session.save()
        response = self.client.get(url)
        self.assertEquals(response.status_code, 200)

        session = self.client.session
        session["myuw_override_date"] = "2013-04-01"
        session.save()
        response = self.client.get(url)
        self.assertEquals(response.status_code, 410)
开发者ID:fanglinfang,项目名称:myuw,代码行数:27,代码来源:future_schedule.py


示例3: test_javerage_email

    def test_javerage_email(self):
        url = reverse("myuw_myplan_api",
                      kwargs={'year': 2013,
                              'quarter': 'autumn'})
        get_user('jinter')
        self.client.login(username='jinter',
                          password=get_user_pass('jinter'))
        response = self.client.get(url)
        self.assertEquals(response.status_code, 200)
        data = json.loads(response.content)
        self.assertEquals(len(data["terms"][0]["courses"]), 5)
        self.assertEquals(data["terms"][0]["has_unready_courses"], True)
        self.assertEquals(data["terms"][0]["has_ready_courses"], False)
        self.assertEquals(data["terms"][0]["has_sections"], False)
        self.assertEquals(data["terms"][0]["ready_count"], 0)
        self.assertEquals(data["terms"][0]["unready_count"], 5)

        url = reverse("myuw_myplan_api",
                      kwargs={'year': 2013,
                              'quarter': 'spring'})
        get_user('jinter')
        self.client.login(username='jinter',
                          password=get_user_pass('jinter'))
        response = self.client.get(url)
        self.assertEquals(response.status_code, 200)
        data = json.loads(response.content)

        self.assertEquals(len(data["terms"][0]["courses"]), 6)
        self.assertEquals(data["terms"][0]["has_unready_courses"], False)
        self.assertEquals(data["terms"][0]["has_ready_courses"], True)
        self.assertEquals(data["terms"][0]["has_sections"], True)
        self.assertEquals(data["terms"][0]["ready_count"], 6)
        self.assertEquals(data["terms"][0]["unready_count"], 0)
开发者ID:mattventura,项目名称:myuw,代码行数:33,代码来源:myplan.py


示例4: test_summer_terms

    def test_summer_terms(self):
        url = reverse("myuw_current_schedule")
        get_user('javerage')
        self.client.login(username='javerage',
                          password=get_user_pass('javerage'))
        session = self.client.session
        session["myuw_override_date"] = "2013-07-06"
        session.save()

        response = self.client.get(url)
        self.assertEquals(response.status_code, 200)

        data = json.loads(response.content)

        self.assertEquals(data["term"]["year"], 2013)
        self.assertEquals(data["term"]["quarter"], 'Summer')
        self.assertEquals(data["summer_term"], "a-term")

        session = self.client.session
        session["myuw_override_date"] = "2013-07-25"
        session.save()

        response = self.client.get(url)
        data = json.loads(response.content)
        self.assertEquals(data["summer_term"], "b-term")
开发者ID:mattventura,项目名称:myuw,代码行数:25,代码来源:schedule.py


示例5: test_missing_current_term

 def test_missing_current_term(self):
     url = reverse("myuw_iasystem_api")
     get_user('err_user')
     self.client.login(username='err_user',
                       password=get_user_pass('err_user'))
     response = self.client.get(url)
     self.assertEquals(response.status_code, 404)
开发者ID:mattventura,项目名称:myuw,代码行数:7,代码来源:iasystem.py


示例6: test_required_migration_desktop_user

    def test_required_migration_desktop_user(self):
        del settings.MYUW_OPTIN_SWITCH_PATH

        # Delete any preference that might have been set, to test the
        # default state.
        UserMigrationPreference.objects.all().delete()
        username = "cfcd208495d565ef66e7dff9f98764da"
        url = reverse("myuw_home")
        get_user(username)
        self.client.login(username=username,
                          password=get_user_pass('random'))
        response = self.client.get(url, **_get_desktop_args())

        # By default, they get sent to the new site
        self.assertEquals(response.status_code, 200)

        # Test with a saved preference of the old site
        obj = UserMigrationPreference.objects.create(username=username,
                                                     use_legacy_site=True)

        response = self.client.get(url, **_get_desktop_args())

        valid_url = "http://some-test-server/myuw"
        self.assertEquals(response.status_code, 302)
        self.assertEquals(response.get("Location"), valid_url)

        # Test with a saved preference for the new site
        obj.use_legacy_site = False
        obj.save()
        response = self.client.get(url, **_get_desktop_args())
        self.assertEquals(response.status_code, 200)
开发者ID:fanglinfang,项目名称:myuw,代码行数:31,代码来源:mobile_login.py


示例7: test_invalid_books

 def test_invalid_books(self):
     url = reverse("myuw_library_api")
     get_user('nouser')
     self.client.login(username='nouser',
                       password=get_user_pass('nouser'))
     response = self.client.get(url)
     self.assertEquals(response.status_code, 404)
开发者ID:fanglinfang,项目名称:myuw,代码行数:7,代码来源:library.py


示例8: test_missing_current_term

 def test_missing_current_term(self):
     url = reverse("myuw_current_schedule")
     get_user('jerror')
     self.client.login(username='jerror',
                       password=get_user_pass('jerror'))
     response = self.client.get(url)
     self.assertEquals(response.status_code, 543)
开发者ID:mattventura,项目名称:myuw,代码行数:7,代码来源:schedule.py


示例9: test_javerage_books

    def test_javerage_books(self):
        url = reverse("myuw_book_api",
                      kwargs={'year': 2013,
                              'quarter': 'spring',
                              'summer_term': ''})
        get_user('javerage')
        self.client.login(username='javerage',
                          password=get_user_pass('javerage'))
        response = self.client.get(url)
        self.assertEquals(response.status_code, 200)

        data = json.loads(response.content)

        self.assertEquals(data["verba_link"],
                          ("%s/m?section_id=AB12345&quarter=spring" %
                           VERBACOMPARE_URL_PREFIX))
        self.assertEquals(
            data["18545"][0]["cover_image_url"],
            ("%s?isbn=9780878935970&key=46c9ef715edb2ec69517e2c8e6ec9c18" %
             IMAGE_URL_PREFIX))
        self.assertEquals(len(data["18545"][0]["authors"]), 1)
        self.assertEquals(data["18545"][0]["is_required"], True)
        self.assertEquals(data["18545"][0]["price"], None)
        self.assertEquals(data["18545"][0]["used_price"], None)
        self.assertEquals(data["18545"][0]["isbn"], '9780878935970')
        self.assertEquals(data["18545"][0]["notes"], 'required')

        self.assertEquals(data["18545"][1]["price"], 44.0)
开发者ID:fanglinfang,项目名称:myuw,代码行数:28,代码来源:books.py


示例10: test_not_in_pws_applicant_access

 def test_not_in_pws_applicant_access(self):
     url = reverse("myuw_home")
     get_user('jnone')
     self.client.login(username='jnone',
                       password=get_user_pass('jnone'))
     response = self.client.get(url,
                                HTTP_USER_AGENT='Fake Android Mobile')
     self.assertEquals(response.status_code, 302)
开发者ID:vegitron,项目名称:myuw,代码行数:8,代码来源:page.py


示例11: test_error

    def test_error(self):
        url = reverse("myuw_hfs_api")
        get_user('jerror')
        self.client.login(username='jerror',
                          password=get_user_pass('javerage'))

        response = self.client.get(url)
        self.assertEquals(response.status_code, 543)
开发者ID:mattventura,项目名称:myuw,代码行数:8,代码来源:hfs.py


示例12: test_none_current_term

    def test_none_current_term(self):
        url = reverse("myuw_current_schedule")
        get_user('none')
        self.client.login(username='none', password=get_user_pass('none'))
        response = self.client.get(url)

        self.assertEquals(response.status_code, 404)
        self.assertEquals(response.content, 'Data not found')
开发者ID:mattventura,项目名称:myuw,代码行数:8,代码来源:schedule.py


示例13: test_random_desktop_user

    def test_random_desktop_user(self):
        url = reverse("myuw_home")
        get_user('random2')
        self.client.login(username='random2', password=get_user_pass('random'))
        response = self.client.get(url, **_get_desktop_args())

        valid_url = "http://some-test-server/myuw"
        self.assertEquals(response.status_code, 302)
        self.assertEquals(response.get("Location"), valid_url)
开发者ID:fanglinfang,项目名称:myuw,代码行数:9,代码来源:mobile_login.py


示例14: test_student_mobile

    def test_student_mobile(self):
        url = reverse("myuw_home")
        get_user('javerage')
        self.client.login(username='javerage',
                          password=get_user_pass('javerage'))
        response = self.client.get(url, **_get_mobile_args())

        valid_url = "http://testserver%s" % reverse("myuw_home")
        self.assertEquals(response.status_code, 200)
开发者ID:fanglinfang,项目名称:myuw,代码行数:9,代码来源:mobile_login.py


示例15: test_undergrad_access

 def test_undergrad_access(self):
     url = reverse("myuw_home")
     get_user('jbothell')
     self.client.login(username='jbothell',
                       password=get_user_pass('jbothell'))
     response = self.client.get(
         url,
         HTTP_USER_AGENT="Lynx/2.8.2rel.1 libwww-FM/2.14")
     self.assertEquals(response.status_code, 200)
开发者ID:vegitron,项目名称:myuw,代码行数:9,代码来源:page.py


示例16: test_random_non_student_mobile_override_url

    def test_random_non_student_mobile_override_url(self):
        url = reverse("myuw_home")
        get_user('staff')
        self.client.login(username='staff', password=get_user_pass('staff'))
        response = self.client.get(url, **_get_mobile_args())

        valid_url = "http://some-test-server/myuw"
        self.assertEquals(response.status_code, 302)
        self.assertEquals(response.get("Location"), valid_url)
开发者ID:mattventura,项目名称:myuw,代码行数:9,代码来源:mobile_login.py


示例17: test_error

 def test_error(self):
     url = reverse("myuw_myplan_api",
                   kwargs={'year': 2013,
                           'quarter': 'spring'})
     get_user('jerror')
     self.client.login(username='jerror',
                       password=get_user_pass('jerror'))
     response = self.client.get(url)
     self.assertEquals(response.status_code, 200)
     self.assertEquals(response.content, '[]')
开发者ID:mattventura,项目名称:myuw,代码行数:10,代码来源:myplan.py


示例18: test_random_non_student_mobile

    def test_random_non_student_mobile(self):
        del settings.MYUW_USER_SERVLET_URL
        url = reverse("myuw_home")
        get_user('random')
        self.client.login(username='random', password=get_user_pass('random'))
        response = self.client.get(url, **_get_mobile_args())

        # This is the default...
        valid_url = "https://myuw.washington.edu/servlet/user"
        self.assertEquals(response.status_code, 302)
        self.assertEquals(response.get("Location"), valid_url)
开发者ID:fanglinfang,项目名称:myuw,代码行数:11,代码来源:mobile_login.py


示例19: test_logout

 def test_logout(self):
     logout_url = reverse("myuw_logout")
     home_url = reverse("myuw_home")
     get_user('javerage')
     self.client.login(username='javerage',
                       password=get_user_pass('javerage'))
     old_session_id = self.client.cookies['sessionid'].value
     response = self.client.get(logout_url, **_get_desktop_args())
     new_session_id = self.client.cookies['sessionid'].value
     self.assertNotEqual(old_session_id, new_session_id)
     self.assertEqual(response.status_code, 302)
     self.assertEqual(response["Location"], LOGOUT_URL)
开发者ID:fanglinfang,项目名称:myuw,代码行数:12,代码来源:logout.py


示例20: test_eight

    def test_eight(self):
        url = reverse("myuw_hfs_api")
        get_user('eight')
        self.client.login(username='eight', password=get_user_pass('eight'))

        response = self.client.get(url)
        self.assertEquals(response.status_code, 200)

        data = json.loads(response.content)
        self.assertEquals(data["employee_husky_card"], None)
        self.assertEquals(data["resident_dining"]["balance"], 15.1)
        self.assertEquals(data["student_husky_card"]["balance"], 100.23)
开发者ID:mattventura,项目名称:myuw,代码行数:12,代码来源:hfs.py



注:本文中的myuw.test.api.get_user函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python api.get_user_pass函数代码示例发布时间:2022-05-27
下一篇:
Python myutils.BetterConfigParser类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap