当前位置: 首页>>代码示例>>Python>>正文


Python products.Products类代码示例

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


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

示例1: test_post_bad_product_name

    def test_post_bad_product_name(self):
        products = Products(config=self.config)

        ok_(not products.post(
            product='Spaces not allowed',
            version='',
        ))
开发者ID:4thAce,项目名称:socorro,代码行数:7,代码来源:test_products.py

示例2: test_post_bad_product_name

    def test_post_bad_product_name(self):
        products = Products(config=self.config)

        build_id = self.now.strftime('%Y%m%d%H%M')
        ok_(not products.post(
            product='Spaces not allowed',
            version='',
        ))
开发者ID:SKY51717,项目名称:socorro,代码行数:8,代码来源:test_products.py

示例3: test_post

    def test_post(self):
        products = Products(config=self.config)

        ok_(products.post(product="KillerApp", version="1.0"))

        # let's check certain things got written to certain tables
        cursor = self.connection.cursor()
        try:
            # expect there to be a new product
            cursor.execute("select product_name from products " "where product_name=%s", ("KillerApp",))
            product_name, = cursor.fetchone()
            eq_(product_name, "KillerApp")
        finally:
            self.connection.rollback()
开发者ID:snorp,项目名称:socorro,代码行数:14,代码来源:test_products.py

示例4: test_get_webapp_products

    def test_get_webapp_products(self):
        api = Products(config=self.config)

        res = api.get(type='webapp')
        res_expected = {
            'products': ['ClockOClock', 'EmailApp'],
            'hits': {
                'EmailApp': [
                    {
                        "product": "EmailApp",
                        "version": "0.2",
                        "start_date": None,
                        "end_date": None,
                        "throttle": 1.0,
                        "featured": False,
                        "release": "Beta",
                        "has_builds": False
                    },
                    {
                        "product": "EmailApp",
                        "version": "0.1",
                        "start_date": None,
                        "end_date": None,
                        "throttle": 1.0,
                        "featured": False,
                        "release": "Release",
                        "has_builds": False
                    }
                ],
                'ClockOClock': [
                    {
                        "product": "ClockOClock",
                        "version": "1.0.18",
                        "start_date": None,
                        "end_date": None,
                        "throttle": 1.0,
                        "featured": False,
                        "release": "Release",
                        "has_builds": False
                    }
                ]
            },
            'total': 3
        }
        self.assertEqual(res, res_expected)
开发者ID:FishingCactus,项目名称:socorro,代码行数:45,代码来源:test_products.py

示例5: test_post

    def test_post(self):
        products = Products(config=self.config)

        build_id = self.now.strftime('%Y%m%d%H%M')
        ok_(products.post(
            product='KillerApp',
            version='1.0',
        ))

        # let's check certain things got written to certain tables
        cursor = self.connection.cursor()
        try:
            # expect there to be a new product
            cursor.execute(
                'select product_name from products '
                "where product_name=%s",
                ('KillerApp',)
            )
            product_name, = cursor.fetchone()
            eq_(product_name, 'KillerApp')
        finally:
            self.connection.rollback()
开发者ID:SKY51717,项目名称:socorro,代码行数:22,代码来源:test_products.py

示例6: test_get_default_version

    def test_get_default_version(self):
        products = Products(config=self.config)

        # Test 1: default versions for all existing products
        res = products.get_default_version()
        res_expected = {"hits": {"Firefox": "8.0", "Thunderbird": "10.0.2b", "Fennec": "12.0b1"}}

        eq_(res, res_expected)

        # Test 2: default version for one product
        params = {"products": "Firefox"}
        res = products.get_default_version(**params)
        res_expected = {"hits": {"Firefox": "8.0"}}

        eq_(res, res_expected)

        # Test 3: default version for two products
        params = {"products": ["Firefox", "Thunderbird"]}
        res = products.get_default_version(**params)
        res_expected = {"hits": {"Firefox": "8.0", "Thunderbird": "10.0.2b"}}

        eq_(res, res_expected)
开发者ID:snorp,项目名称:socorro,代码行数:22,代码来源:test_products.py

示例7: test_get

    def test_get(self):
        products = Products(config=self.config)
        now = datetimeutil.utc_now().date()
        lastweek = now - datetime.timedelta(days=7)
        now_str = datetimeutil.date_to_string(now)
        lastweek_str = datetimeutil.date_to_string(lastweek)

        #......................................................................
        # Test 1: find one exact match for one product and one version
        params = {
            "versions": "Firefox:8.0"
        }
        res = products.get(**params)
        res_expected = {
            "hits": [
                {
                    "product": "Firefox",
                    "version": "8.0",
                    "start_date": now_str,
                    "end_date": now_str,
                    "is_featured": False,
                    "build_type": "Release",
                    "throttle": 10.0,
                    "has_builds": False
                 }
            ],
            "total": 1
        }

        self.assertEqual(res, res_expected)

        #......................................................................
        # Test 2: Find two different products with their correct verions
        params = {
            "versions": ["Firefox:8.0", "Thunderbird:10.0.2b"]
        }
        res = products.get(**params)
        res_expected = {
            "hits": [
                {
                    "product": "Firefox",
                    "version": "8.0",
                    "start_date": now_str,
                    "end_date": now_str,
                    "is_featured": False,
                    "build_type": "Release",
                    "throttle": 10.0,
                    "has_builds": False
                 },
                 {
                    "product": "Thunderbird",
                    "version": "10.0.2b",
                    "start_date": now_str,
                    "end_date": now_str,
                    "is_featured": False,
                    "build_type": "Release",
                    "throttle": 10.0,
                    "has_builds": False
                 }
            ],
            "total": 2
        }

        self.assertEqual(res, res_expected)

        #......................................................................
        # Test 3: empty result, no products:version found
        params = {
            "versions": "Firefox:14.0"
        }
        res = products.get(**params)
        res_expected = {
            "hits": [],
            "total": 0
        }

        self.assertEqual(res, res_expected)

        #......................................................................
        # Test 4: Test products list is returned with no parameters
        # Note that the expired version is not returned
        params = {}
        res = products.get(**params)
        res_expected = {
                "products": ["Firefox", "Thunderbird", "Fennec"],
                "hits": {
                    "Firefox": [
                        {
                            "product": "Firefox",
                            "version": "8.0",
                            "start_date": now_str,
                            "end_date": now_str,
                            "throttle": 10.00,
                            "featured": False,
                            "release": "Release",
                            "has_builds": False
                        }
                    ],
                    "Thunderbird": [
                        {
#.........这里部分代码省略.........
开发者ID:ajsb85,项目名称:socorro,代码行数:101,代码来源:test_products.py

示例8: test_get

    def test_get(self):
        products = Products(config=self.config)
        now = self.now.date()
        lastweek = now - datetime.timedelta(days=7)
        nextweek = now + datetime.timedelta(days=7)
        now_str = datetimeutil.date_to_string(now)
        lastweek_str = datetimeutil.date_to_string(lastweek)
        nextweek_str = datetimeutil.date_to_string(nextweek)

        #......................................................................
        # Test 1: find one exact match for one product and one version
        params = {
            "versions": "Firefox:8.0"
        }
        res = products.get(**params)
        res_expected = {
            "hits": [
                {
                    "is_featured": False,
                    "version": "8.0",
                    "throttle": 10.0,
                    "start_date": now_str,
                    "end_date": now_str,
                    "has_builds": False,
                    "product": "Firefox",
                    "build_type": "Release"
                }
            ],
            "total": 1
        }
        # make sure the 'throttle' is a floating point number
        ok_(isinstance(res['hits'][0]['throttle'], float))
        eq_(
            sorted(res['hits'][0]),
            sorted(res_expected['hits'][0])
        )

        #......................................................................
        # Test 2: Find two different products with their correct verions
        params = {
            "versions": ["Firefox:8.0", "Thunderbird:10.0.2b"]
        }
        res = products.get(**params)
        res_expected = {
            "hits": [
                {
                    "product": "Firefox",
                    "version": "8.0",
                    "start_date": now_str,
                    "end_date": now_str,
                    "is_featured": False,
                    "build_type": "Release",
                    "throttle": 10.0,
                    "has_builds": True
                },
                {
                    "product": "Thunderbird",
                    "version": "10.0.2b",
                    "start_date": now_str,
                    "end_date": now_str,
                    "is_featured": False,
                    "build_type": "Release",
                    "throttle": 10.0,
                    "has_builds": False
                }
            ],
            "total": 2
        }

        eq_(
            sorted(res['hits'][0]),
            sorted(res_expected['hits'][0])
        )

        #......................................................................
        # Test 3: empty result, no products:version found
        params = {
            "versions": "Firefox:14.0"
        }
        res = products.get(**params)
        res_expected = {
            "hits": [],
            "total": 0
        }

        eq_(res, res_expected)

        #......................................................................
        # Test 4: Test products list is returned with no parameters
        params = {}
        res = products.get(**params)
        res_expected = {
            "products": ["Firefox", "Thunderbird", "Fennec"],
            "hits": {
                "Firefox": [
                    {
                        "product": "Firefox",
                        "version": "9.0",
                        "start_date": now_str,
                        "end_date": nextweek_str,
#.........这里部分代码省略.........
开发者ID:4thAce,项目名称:socorro,代码行数:101,代码来源:test_products.py

示例9: test_get

    def test_get(self):
        products = Products(config=self.config)
        now = datetimeutil.utc_now()
        now = datetime.datetime(now.year, now.month, now.day)
        now_str = datetimeutil.date_to_string(now)

        #......................................................................
        # Test 1: find one exact match for one product and one version
        params = {
            "versions": "Firefox:8.0"
        }
        res = products.get(**params)
        res_expected = {
            "hits": [
                {
                    "product": "Firefox",
                    "version": "8.0",
                    "start_date": now_str,
                    "end_date": now_str,
                    "is_featured": False,
                    "build_type": "Release",
                    "throttle": 10.0
                 }
            ],
            "total": 1
        }

        self.assertEqual(res, res_expected)

        #......................................................................
        # Test 2: Find two different products with their correct verions
        params = {
            "versions": ["Firefox:8.0", "Thunderbird:10.0.2b"]
        }
        res = products.get(**params)
        res_expected = {
            "hits": [
                {
                    "product": "Firefox",
                    "version": "8.0",
                    "start_date": now_str,
                    "end_date": now_str,
                    "is_featured": False,
                    "build_type": "Release",
                    "throttle": 10.0
                 },
                 {
                    "product": "Thunderbird",
                    "version": "10.0.2b",
                    "start_date": now_str,
                    "end_date": now_str,
                    "is_featured": False,
                    "build_type": "Release",
                    "throttle": 10.0
                 }
            ],
            "total": 2
        }

        self.assertEqual(res, res_expected)

        #......................................................................
        # Test 3: empty result, no products:version found
        params = {
            "versions": "Firefox:14.0"
        }
        res = products.get(**params)
        res_expected = {
            "hits": [],
            "total": 0
        }

        self.assertEqual(res, res_expected)

        #......................................................................
        # Test 4: Test products list is returned with no parameters
        params = {}
        res = products.get(**params)
        res_expected = {
                "hits": [
                    {
                        "product_name": "Firefox",
                        "release_name": "firefox",
                        "sort": 1,
                        "rapid_release_version": "8.0"
                     },
                    {
                        "product_name": "Fennec",
                        "release_name": "mobile",
                        "sort": 3,
                        "rapid_release_version": "11.0"
                     },
                    {
                        "product_name": "Thunderbird",
                        "release_name": "thunderbird",
                        "sort": 2,
                        "rapid_release_version": "10.0"
                     }
                ],
                "total": 3
#.........这里部分代码省略.........
开发者ID:phb,项目名称:socorro,代码行数:101,代码来源:test_products.py

示例10: test_get

    def test_get(self):
        products = Products(config=self.config)
        now = self.now.date()
        now_str = datetimeutil.date_to_string(now)

        # ......................................................................
        # Test 1: find one exact match for one product and one version
        params = {"versions": "Firefox:8.0"}
        res = products.get(**params)
        res_expected = {
            "hits": [
                {
                    "is_featured": False,
                    "version": "8.0",
                    "throttle": 10.0,
                    "start_date": now_str,
                    "end_date": now_str,
                    "has_builds": False,
                    "product": "Firefox",
                    "build_type": "Release",
                }
            ],
            "total": 1,
        }

        eq_(sorted(res["hits"][0]), sorted(res_expected["hits"][0]))

        # ......................................................................
        # Test 2: Find two different products with their correct verions
        params = {"versions": ["Firefox:8.0", "Thunderbird:10.0.2b"]}
        res = products.get(**params)
        res_expected = {
            "hits": [
                {
                    "product": "Firefox",
                    "version": "8.0",
                    "start_date": now_str,
                    "end_date": now_str,
                    "is_featured": False,
                    "build_type": "Release",
                    "throttle": 10.0,
                    "has_builds": False,
                },
                {
                    "product": "Thunderbird",
                    "version": "10.0.2b",
                    "start_date": now_str,
                    "end_date": now_str,
                    "is_featured": False,
                    "build_type": "Release",
                    "throttle": 10.0,
                    "has_builds": False,
                },
            ],
            "total": 2,
        }

        eq_(sorted(res["hits"][0]), sorted(res_expected["hits"][0]))

        # ......................................................................
        # Test 3: empty result, no products:version found
        params = {"versions": "Firefox:14.0"}
        res = products.get(**params)
        res_expected = {"hits": [], "total": 0}

        eq_(res, res_expected)

        # ......................................................................
        # Test 4: Test products list is returned with no parameters
        # Note that the expired version is not returned
        params = {}
        res = products.get(**params)
        res_expected = {
            "products": ["Firefox", "Thunderbird", "Fennec"],
            "hits": {
                "Firefox": [
                    {
                        "product": "Firefox",
                        "version": "8.0",
                        "start_date": now_str,
                        "end_date": now_str,
                        "throttle": 10.00,
                        "featured": False,
                        "release": "Release",
                        "has_builds": False,
                    }
                ],
                "Thunderbird": [
                    {
                        "product": "Thunderbird",
                        "version": "10.0.2b",
                        "start_date": now_str,
                        "end_date": now_str,
                        "throttle": 10.00,
                        "featured": False,
                        "release": "Release",
                        "has_builds": False,
                    }
                ],
                "Fennec": [
#.........这里部分代码省略.........
开发者ID:snorp,项目名称:socorro,代码行数:101,代码来源:test_products.py


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