コード例 #1
0
ファイル: test_api2.py プロジェクト: chinna1986/standup
 def setUp(self):
     super(UpdateTeamTestCase, self).setUp()
     self.url = '/api/v2/teams/update.json'
     self.data = {'slug': 'test', 'name': 'Updated Team',
                  'api_key': self.app.config.get('API_KEY')}
     with self.app.app_context():
         team(slug=self.data['slug'], name='Test Team', save=True)
コード例 #2
0
ファイル: test_status.py プロジェクト: robhudson/standup
    def test_contextual_feeds(self):
        """Test that team/project/user Atom feeds appear as <link> tags."""

        with self.app.app_context():
            user(email='*****@*****.**', save=True)
            u = user(username='******', email="*****@*****.**",
                     name='Buffy Summers', slug='buffy', save=True)
            team(name='Scooby Gang', slug='scoobies', users=[u], save=True)
            project(name='Kill The Master', slug='master', save=True)

        authenticate(self.client, u)

        site_url = self.app.config.get('SITE_URL')

        rv = self.client.get('/')
        assert ('<link rel="alternate" type="application/atom+xml" '
                'href="%s/statuses.xml"') % site_url in rv.data
        assert ('<link rel="alternate" type="application/atom+xml" '
                'href="%s/project/') % site_url not in rv.data

        rv = self.client.get('/team/scoobies')
        assert ('<link rel="alternate" type="application/atom+xml" '
                'href="%s/team/') % site_url in rv.data

        rv = self.client.get('/project/master')
        assert ('<link rel="alternate" type="application/atom+xml" '
                'href="%s/project/') % site_url in rv.data

        rv = self.client.get('/user/buffy')
        assert ('<link rel="alternate" type="application/atom+xml" '
                'href="%s/user/') % site_url in rv.data
コード例 #3
0
 def setUp(self):
     super(UpdateTeamTestCase, self).setUp()
     self.url = '/api/v2/teams/update.json'
     self.data = {'slug': 'test', 'name': 'Updated Team',
                  'api_key': self.app.config.get('API_KEY')}
     with self.app.app_context():
         team(slug=self.data['slug'], name='Test Team', save=True)
コード例 #4
0
    def test_contextual_feeds(self):
        """Test that team/project/user Atom feeds appear as <link> tags."""

        with self.app.app_context():
            user(email='*****@*****.**', save=True)
            u = user(username='******',
                     email="*****@*****.**",
                     name='Buffy Summers',
                     slug='buffy',
                     save=True)
            team(name='Scooby Gang', slug='scoobies', users=[u], save=True)
            project(name='Kill The Master', slug='master', save=True)

        authenticate(self.client, u)

        site_url = self.app.config.get('SITE_URL')

        rv = self.client.get('/')
        assert ('<link rel="alternate" type="application/atom+xml" '
                'href="%s/statuses.xml"') % site_url in rv.data
        assert ('<link rel="alternate" type="application/atom+xml" '
                'href="%s/project/') % site_url not in rv.data

        rv = self.client.get('/team/scoobies')
        assert ('<link rel="alternate" type="application/atom+xml" '
                'href="%s/team/') % site_url in rv.data

        rv = self.client.get('/project/master')
        assert ('<link rel="alternate" type="application/atom+xml" '
                'href="%s/project/') % site_url in rv.data

        rv = self.client.get('/user/buffy')
        assert ('<link rel="alternate" type="application/atom+xml" '
                'href="%s/user/') % site_url in rv.data
コード例 #5
0
    def test_team_recent_statuses(self):
        """Test loading of recent statuses for a project."""
        with self.app.app_context():
            t = team(save=True)
            u = user(teams=[t], save=True)
            u2 = user(username='******',
                      slug='troll',
                      email='*****@*****.**',
                      save=True)

            # Create 30 statuses
            for i in range(30):
                s = status(project=None, user=u, save=True)

            # Create 30 replies
            for i in range(30):
                status(project=None, user=u, reply_to=s, save=True)

            # Create 30 statuses for user not in team
            for i in range(10):
                status(project=None, user=u2, save=True)

            # Should not include replies
            page = t.recent_statuses()
            eq_(page.pages, 2)
コード例 #6
0
ファイル: test_api2.py プロジェクト: safwanrahman/standup
    def setUp(self):
        super(TeamMembersTestCase, self).setUp()

        self.query = {"slug": "test"}
        self.url = "/api/v2/teams/members.json"

        with self.app.app_context():
            self.team = team(slug=self.query["slug"], name="Test Team", save=True)
            self.user = user(save=True)
コード例 #7
0
ファイル: test_api2.py プロジェクト: chinna1986/standup
    def setUp(self):
        super(TeamMembersTestCase, self).setUp()

        self.query = {'slug': 'test'}
        self.url = '/api/v2/teams/members.json'

        with self.app.app_context():
            self.team = team(slug=self.query['slug'], name='Test Team',
                             save=True)
            self.user = user(save=True)
コード例 #8
0
    def setUp(self):
        super(TeamMembersTestCase, self).setUp()

        self.query = {'slug': 'test'}
        self.url = '/api/v2/teams/members.json'

        with self.app.app_context():
            self.team = team(slug=self.query['slug'], name='Test Team',
                             save=True)
            self.user = user(save=True)
コード例 #9
0
    def test_feeds(self):
        """Test that the site-wise Atom feed appears and functions properly."""
        with self.app.app_context():
            u = user(email='*****@*****.**', slug='joe', save=True)
            team(users=[u], slug='a-team', save=True)
            p = project(slug='prjkt', save=True)

            for i in range(20):
                status(user=u,
                       project=p,
                       content='foo',
                       content_html='foo',
                       save=True)

        authenticate(self.client, u)

        site_url = self.app.config.get('SITE_URL')

        # Ensure the Atom link appears in the rendered HTML.
        rv = self.client.get('/')
        assert ('<link rel="alternate" type="application/atom+xml" '
                'href="%s/statuses.xml"') % site_url in rv.data

        # Make sure the Atom feed displays statuses.
        rv = self.client.get('/statuses.xml')
        assert '<entry' in rv.data
        assert ('<content type="html">&lt;h3&gt;Test Project&lt;/h3&gt;&lt;p'
                '&gt;foo&lt;/p&gt;</content>') in rv.data

        rv = self.client.get('/user/joe.xml')
        assert '<entry' in rv.data
        assert ('<content type="html">&lt;h3&gt;Test Project&lt;/h3&gt;&lt;p'
                '&gt;foo&lt;/p&gt;</content>') in rv.data

        rv = self.client.get('/project/prjkt.xml')
        assert '<entry' in rv.data
        assert ('<content type="html">&lt;h3&gt;Test Project&lt;/h3&gt;&lt;p'
                '&gt;foo&lt;/p&gt;</content>') in rv.data

        rv = self.client.get('/team/a-team.xml')
        assert '<entry' in rv.data
        assert ('<content type="html">&lt;h3&gt;Test Project&lt;/h3&gt;&lt;p'
                '&gt;foo&lt;/p&gt;</content>') in rv.data
コード例 #10
0
ファイル: test_api2.py プロジェクト: chinna1986/standup
    def setUp(self):
        super(CreateTeamMemberTestCase, self).setUp()

        with self.app.app_context():
            self.user = user(save=True)
            self.team = team(save=True)

        self.url = '/api/v2/teams/members/create.json'
        self.data = {'slug': self.team.slug,
                     'screen_name': self.user.username,
                     'api_key': self.app.config.get('API_KEY')}
コード例 #11
0
    def test_team_view(self):
        """Make sure the project view works like it's supposed to."""
        with self.app.app_context():
            u = user(save=True)
            t = team(users=[u], save=True)

        response = self.client.get('/team/%s' % t.slug)
        eq_(response.status_code, 200)

        response = self.client.get('/team/not-a-real-team')
        eq_(response.status_code, 404)
コード例 #12
0
    def setUp(self):
        super(CreateTeamMemberTestCase, self).setUp()

        with self.app.app_context():
            self.user = user(save=True)
            self.team = team(save=True)

        self.url = '/api/v2/teams/members/create.json'
        self.data = {'slug': self.team.slug,
                     'screen_name': self.user.username,
                     'api_key': self.app.config.get('API_KEY')}
コード例 #13
0
ファイル: test_status.py プロジェクト: robhudson/standup
    def test_team_view(self):
        """Make sure the project view works like it's supposed to."""
        with self.app.app_context():
            u = user(save=True)
            t = team(users=[u], save=True)

        response = self.client.get('/team/%s' % t.slug)
        eq_(response.status_code, 200)

        response = self.client.get('/team/not-a-real-team')
        eq_(response.status_code, 404)
コード例 #14
0
ファイル: test_status.py プロジェクト: robhudson/standup
    def test_feeds(self):
        """Test that the site-wise Atom feed appears and functions properly."""
        with self.app.app_context():
            u = user(email='*****@*****.**', slug='joe', save=True)
            team(users=[u], slug='a-team', save=True)
            p = project(slug='prjkt', save=True)

            for i in range(20):
                status(user=u, project=p, content='foo', content_html='foo',
                       save=True)

        authenticate(self.client, u)

        site_url = self.app.config.get('SITE_URL')

        # Ensure the Atom link appears in the rendered HTML.
        rv = self.client.get('/')
        assert ('<link rel="alternate" type="application/atom+xml" '
                'href="%s/statuses.xml"') % site_url in rv.data

        # Make sure the Atom feed displays statuses.
        rv = self.client.get('/statuses.xml')
        assert '<entry' in rv.data
        assert ('<content type="html">&lt;h3&gt;Test Project&lt;/h3&gt;&lt;p'
                '&gt;foo&lt;/p&gt;</content>') in rv.data

        rv = self.client.get('/user/joe.xml')
        assert '<entry' in rv.data
        assert ('<content type="html">&lt;h3&gt;Test Project&lt;/h3&gt;&lt;p'
                '&gt;foo&lt;/p&gt;</content>') in rv.data

        rv = self.client.get('/project/prjkt.xml')
        assert '<entry' in rv.data
        assert ('<content type="html">&lt;h3&gt;Test Project&lt;/h3&gt;&lt;p'
                '&gt;foo&lt;/p&gt;</content>') in rv.data

        rv = self.client.get('/team/a-team.xml')
        assert '<entry' in rv.data
        assert ('<content type="html">&lt;h3&gt;Test Project&lt;/h3&gt;&lt;p'
                '&gt;foo&lt;/p&gt;</content>') in rv.data
コード例 #15
0
ファイル: test_api2.py プロジェクト: safwanrahman/standup
    def setUp(self):
        super(CreateTeamMemberTestCase, self).setUp()

        with self.app.app_context():
            self.user = user(save=True)
            self.team = team(save=True)

        self.url = "/api/v2/teams/members/create.json"
        self.data = {
            "slug": self.team.slug,
            "screen_name": self.user.username,
            "api_key": self.app.config.get("API_KEY"),
        }
コード例 #16
0
ファイル: test_api2.py プロジェクト: chinna1986/standup
    def setUp(self):
        super(DestroyTeamMemberTestCase, self).setUp()

        with self.app.app_context():
            self.user = user(save=True)
            self.team = team(save=True)

        db = get_session(self.app)
        self.team.users.append(self.user)
        db.commit()

        self.url = '/api/v2/teams/members/destroy.json'
        self.data = {'slug': self.team.slug,
                     'screen_name': self.user.username,
                     'api_key': self.app.config.get('API_KEY')}
コード例 #17
0
    def setUp(self):
        super(DestroyTeamMemberTestCase, self).setUp()

        with self.app.app_context():
            self.user = user(save=True)
            self.team = team(save=True)

        db = get_session(self.app)
        self.team.users.append(self.user)
        db.commit()

        self.url = '/api/v2/teams/members/destroy.json'
        self.data = {'slug': self.team.slug,
                     'screen_name': self.user.username,
                     'api_key': self.app.config.get('API_KEY')}
コード例 #18
0
ファイル: test_api2.py プロジェクト: safwanrahman/standup
    def setUp(self):
        super(DestroyTeamMemberTestCase, self).setUp()

        with self.app.app_context():
            self.user = user(save=True)
            self.team = team(save=True)

        db = get_session(self.app)
        self.team.users.append(self.user)
        db.commit()

        self.url = "/api/v2/teams/members/destroy.json"
        self.data = {
            "slug": self.team.slug,
            "screen_name": self.user.username,
            "api_key": self.app.config.get("API_KEY"),
        }
コード例 #19
0
ファイル: test_users.py プロジェクト: Ms2ger/standup
    def test_team_recent_statuses(self):
        """Test loading of recent statuses for a project."""
        with self.app.app_context():
            t = team(save=True)
            u = user(teams=[t], save=True)
            u2 = user(username='******', slug='troll', email='*****@*****.**',
                      save=True)

            # Create 30 statuses
            for i in range(30):
                s = status(project=None, user=u, save=True)

            # Create 30 replies
            for i in range(30):
                status(project=None, user=u, reply_to=s, save=True)

            # Create 30 statuses for user not in team
            for i in range(10):
                status(project=None, user=u2, save=True)

            # Should not include replies
            page = t.recent_statuses()
            eq_(page.pages, 2)
コード例 #20
0
ファイル: test_users.py プロジェクト: Ms2ger/standup
    def test_team_repr(self):
        """Test the __repr__ function of the Team model."""
        with self.app.app_context():
            t = team(name='A-Team')

        eq_(repr(t), '<Team: A-Team>')
コード例 #21
0
 def test_timeline_filter_by_team_id(self):
     with self.app.app_context():
         t = team(save=True)
     self.query = {'team_id': t.id}
     response = self.client.get(self._url())
     eq_(response.status_code, 200)
コード例 #22
0
ファイル: test_api2.py プロジェクト: safwanrahman/standup
 def setUp(self):
     super(UpdateTeamTestCase, self).setUp()
     self.url = "/api/v2/teams/update.json"
     self.data = {"slug": "test", "name": "Updated Team", "api_key": self.app.config.get("API_KEY")}
     with self.app.app_context():
         team(slug=self.data["slug"], name="Test Team", save=True)
コード例 #23
0
ファイル: test_api2.py プロジェクト: chinna1986/standup
 def test_timeline_filter_by_team_id(self):
     with self.app.app_context():
         t = team(save=True)
     self.query = {'team_id': t.id}
     response = self.client.get(self._url())
     eq_(response.status_code, 200)
コード例 #24
0
    def test_team_repr(self):
        """Test the __repr__ function of the Team model."""
        with self.app.app_context():
            t = team(name='A-Team')

        eq_(repr(t), '<Team: A-Team>')