示例#1
0
    def read(self, request):
        try:
            response = json.dumps(get_marketplaces())
        except:
            return build_response(request, 400, 'Invalid request')

        return HttpResponse(response, status=200, mimetype='application/JSON; charset=UTF-8')
示例#2
0
    def read(self, request):
        try:
            response = json.dumps(get_marketplaces())
        except:
            return build_response(request, 400, 'Invalid request')

        return HttpResponse(response,
                            status=200,
                            mimetype='application/JSON; charset=UTF-8')
示例#3
0
文件: tests.py 项目: huygun/wstore
    def test_basic_retrieving_of_markets(self):

        markets = markets_management.get_marketplaces()

        self.assertEquals(len(markets), 3)
        self.assertEquals(markets[0]['name'], 'test_market1')
        self.assertEquals(markets[0]['host'], 'http://examplemarketplace1.com/')
        self.assertEquals(markets[1]['name'], 'test_market2')
        self.assertEquals(markets[1]['host'], 'http://examplemarketplace2.com/')
        self.assertEquals(markets[2]['name'], 'test_market3')
        self.assertEquals(markets[2]['host'], 'http://examplemarketplace3.com/')
示例#4
0
    def test_basic_retrieving_of_markets(self):

        markets = markets_management.get_marketplaces()

        self.assertEquals(len(markets), 3)
        self.assertEquals(markets[0]['name'], 'test_market1')
        self.assertEquals(markets[0]['host'], 'http://examplemarketplace1.com/')
        self.assertEquals(markets[0]['api_version'], 1)
        self.assertEquals(markets[1]['name'], 'test_market2')
        self.assertEquals(markets[1]['host'], 'http://examplemarketplace2.com/')
        self.assertEquals(markets[1]['api_version'], 1)
        self.assertEquals(markets[2]['name'], 'test_market3')
        self.assertEquals(markets[2]['host'], 'http://examplemarketplace3.com/')
        self.assertEquals(markets[2]['api_version'], 2)
示例#5
0
    def test_basic_retrieving_of_markets(self):

        markets = markets_management.get_marketplaces()

        self.assertEquals(len(markets), 3)
        self.assertEquals(markets[0]["name"], "test_market1")
        self.assertEquals(markets[0]["host"], "http://examplemarketplace1.com/")
        self.assertEquals(markets[0]["api_version"], 1)
        self.assertEquals(markets[1]["name"], "test_market2")
        self.assertEquals(markets[1]["host"], "http://examplemarketplace2.com/")
        self.assertEquals(markets[1]["api_version"], 1)
        self.assertEquals(markets[2]["name"], "test_market3")
        self.assertEquals(markets[2]["host"], "http://examplemarketplace3.com/")
        self.assertEquals(markets[2]["api_version"], 2)