Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(30)  |  Call(30)  |  Derive(0)  |  Import(0)

src/s/t/stackalytics-HEAD/tests/api/test_modules.py   stackalytics(Download)
            modules = json.loads(response.data)['modules']
            self.assertEqual(
                [{'id': 'glance', 'text': 'glance', 'tag': 'module'},
                 {'id': 'nova', 'text': 'nova', 'tag': 'module'},
                 {'id': 'nova-cli', 'text': 'nova-cli', 'tag': 'module'},
            modules = json.loads(response.data)['modules']
            self.assertEqual(
                [{'id': 'glance', 'text': 'glance', 'tag': 'module'},
                 {'id': 'nova', 'text': 'nova', 'tag': 'module'},
                 {'id': 'nova-group', 'text': 'nova-group', 'tag': 'group'}],
            modules = json.loads(response.data)['modules']
            self.assertEqual(
                [{'id': 'glance', 'text': 'glance', 'tag': 'module'}],
                modules,
                message='Expected modules which name contains query')
            module = json.loads(response.data)['module']
            self.assertEqual(
                {'id': 'nova', 'text': 'nova', 'tag': 'module'}, module)
 
            response = self.app.get('/api/1.0/modules/nova-group')
            module = json.loads(response.data)['module']
            self.assertEqual(
                {'tag': 'group', 'id': 'nova-group', 'text': 'nova-group'},

src/s/t/stackalytics-HEAD/tests/api/test_releases.py   stackalytics(Download)
    def test_releases_empty(self):
        with test_api.make_runtime_storage({}):
            response = self.app.get('/api/1.0/releases')
            self.assertEqual(200, response.status_code)
 
            response = self.app.get('/api/1.0/releases')
            releases = json.loads(response.data)['releases']
            self.assertEqual(3, len(releases))
            self.assertIn({'id': 'all', 'text': 'All'}, releases)
            self.assertIn({'id': 'icehouse', 'text': 'Icehouse'}, releases)
            response = self.app.get('/api/1.0/releases?query=hav')
            releases = json.loads(response.data)['releases']
            self.assertEqual(1, len(releases))
            self.assertIn({'id': 'havana', 'text': 'Havana'}, releases)
 
            response = self.app.get('/api/1.0/releases/icehouse')
            release = json.loads(response.data)['release']
            self.assertEqual({'id': 'icehouse', 'text': 'Icehouse'}, release)
 

src/s/t/stackalytics-HEAD/tests/api/test_users.py   stackalytics(Download)
                                    'module=nova&metric=commits')
            users = json.loads(response.data)['users']
            self.assertEqual(2, len(users))
            self.assertIn({'id': 'john_doe', 'text': 'John Doe'}, users)
            self.assertIn({'id': 'bill_smith', 'text': 'Bill Smith'}, users)
                                    'module=nova&query=doe&metric=commits')
            users = json.loads(response.data)['users']
            self.assertEqual(1, len(users))
            self.assertIn({'id': 'john_doe', 'text': 'John Doe'}, users)
 
            response = self.app.get('/api/1.0/users/john_doe')
            user = json.loads(response.data)['user']
            self.assertEqual('john_doe', user['user_id'])
 
    def test_user_not_found(self):
                                      user_name=['John Doe', 'Bill Smith'])):
            response = self.app.get('/api/1.0/users/nonexistent')
            self.assertEqual(404, response.status_code)
 

src/s/t/stackalytics-HEAD/tests/api/test_stats.py   stackalytics(Download)
                                    'project_type=all')
            stats = json.loads(response.data)['stats']
            self.assertEqual(2, len(stats))
            self.assertEqual(600, stats[0]['metric'])
            self.assertEqual('glance', stats[0]['id'])
            self.assertEqual(60, stats[1]['metric'])
            self.assertEqual('nova', stats[1]['id'])

src/s/t/stackalytics-HEAD/tests/api/test_companies.py   stackalytics(Download)
                                    'module=glance')
            companies = json.loads(response.data)['companies']
            self.assertEqual([{'id': 'ibm', 'text': 'IBM'},
                              {'id': 'nec', 'text': 'NEC'},
                              {'id': 'ntt', 'text': 'NTT'}], companies)
 
            response = self.app.get('/api/1.0/companies?metric=marks&'
                                    'module=glance')
            companies = json.loads(response.data)['companies']
            self.assertEqual([{'id': 'ibm', 'text': 'IBM'},
                                    'company_name=ib&module=glance')
            companies = json.loads(response.data)['companies']
            self.assertEqual([{'id': 'ibm', 'text': 'IBM'}], companies)
 
    def test_get_company(self):
            response = self.app.get('/api/1.0/companies/nec?module=glance')
            company = json.loads(response.data)['company']
            self.assertEqual({'id': 'nec', 'text': 'NEC'}, company)
 
            response = self.app.get('/api/1.0/companies/google?module=glance')
            self.assertEqual(404, response.status_code)