コード例 #1
0
ファイル: test_apps.py プロジェクト: sibson/dynoup
    def test_get_app_with_checks(self):
        self.add_heroku_response(responses.GET, '/account/rate-limits')
        happs = self.add_heroku_response(responses.GET, '/apps')
        app_id = happs[0]['id']
        happ = self.add_heroku_response(responses.GET,
                                        '/apps/{}'.format(app_id))

        with app.test_request_context():
            url = api.url_for(App, app_id=app_id)

        dbapp = models.App(id=app_id, name=happ['name'])
        db.session.add(dbapp)
        check = models.Check(app_id=app_id,
                             url='http://example.com',
                             dynotype='test')
        db.session.add(check)

        response = self.client.get(url)
        data = json.loads(response.data)

        self.assertEquals(
            data, {
                'name': dbapp.name,
                'id': dbapp.id,
                'checks': {
                    check.dynotype: str(check.id)
                },
            })
コード例 #2
0
ファイル: test_apps.py プロジェクト: sibson/dynoup
    def test_get_list(self):
        self.add_heroku_response(responses.GET, '/account/rate-limits')
        happs = self.add_heroku_response(responses.GET, '/apps')

        with app.test_request_context():
            url = api.url_for(AppList)

        response = self.client.get(url)

        data = json.loads(response.data)

        self.assertEquals(data, {
            happs[0]['name']: happs[0]['id'],
        })
コード例 #3
0
ファイル: test_apps.py プロジェクト: sibson/dynoup
    def test_get_list(self):
        self.add_heroku_response(responses.GET, '/account/rate-limits')
        happs = self.add_heroku_response(responses.GET, '/apps')

        with app.test_request_context():
            url = api.url_for(AppList)

        response = self.client.get(url)

        data = json.loads(response.data)

        self.assertEquals(data, {
            happs[0]['name']:  happs[0]['id'],
        })
コード例 #4
0
ファイル: test_apps.py プロジェクト: sibson/dynoup
    def test_get_app_no_model(self):
        self.add_heroku_response(responses.GET, '/account/rate-limits')
        happs = self.add_heroku_response(responses.GET, '/apps')
        app_id = happs[0]['id']
        happ = self.add_heroku_response(responses.GET, '/apps/{}'.format(app_id))

        with app.test_request_context():
            url = api.url_for(App, app_id=app_id)

        response = self.client.get(url)
        data = json.loads(response.data)

        self.assertEquals(data, {
            'name': happ['name'],
            'id': happ['id'],
            'checks': {},
        })
コード例 #5
0
ファイル: test_apps.py プロジェクト: sibson/dynoup
    def test_get_app_no_model(self):
        self.add_heroku_response(responses.GET, '/account/rate-limits')
        happs = self.add_heroku_response(responses.GET, '/apps')
        app_id = happs[0]['id']
        happ = self.add_heroku_response(responses.GET,
                                        '/apps/{}'.format(app_id))

        with app.test_request_context():
            url = api.url_for(App, app_id=app_id)

        response = self.client.get(url)
        data = json.loads(response.data)

        self.assertEquals(data, {
            'name': happ['name'],
            'id': happ['id'],
            'checks': {},
        })
コード例 #6
0
ファイル: test_apps.py プロジェクト: sibson/dynoup
    def test_get_app_with_checks(self):
        self.add_heroku_response(responses.GET, '/account/rate-limits')
        happs = self.add_heroku_response(responses.GET, '/apps')
        app_id = happs[0]['id']
        happ = self.add_heroku_response(responses.GET, '/apps/{}'.format(app_id))

        with app.test_request_context():
            url = api.url_for(App, app_id=app_id)

        dbapp = models.App(id=app_id, name=happ['name'])
        db.session.add(dbapp)
        check = models.Check(app_id=app_id, url='http://example.com', dynotype='test')
        db.session.add(check)

        response = self.client.get(url)
        data = json.loads(response.data)

        self.assertEquals(data, {
            'name': dbapp.name,
            'id': dbapp.id,
            'checks': {check.dynotype: str(check.id)},
        })
コード例 #7
0
ファイル: test_apps.py プロジェクト: sibson/dynoup
 def setUp(self):
     super(CheckTestCase, self).setUp()
     self.app = self.create_app()
     self.user = self.create_user()
     with app.test_request_context():
         self.url = api.url_for(Check, app_id=self.app.id, dynotype='web')
コード例 #8
0
ファイル: test_apps.py プロジェクト: sibson/dynoup
 def setUp(self):
     super(CheckTestCase, self).setUp()
     self.app = self.create_app()
     self.user = self.create_user()
     with app.test_request_context():
         self.url = api.url_for(Check, app_id=self.app.id, dynotype='web')