def test_convert_unformated_author_name_to_gravatar():
    gravatar_link = 'http://gravatar.com/avatar/'
    author_name = None

    assert template_filters.gravatar(author_name) == gravatar_link
        
        
Beispiel #2
0
    def buildstatus(self, *args, **kw):
        ctx = self.server.context

        projects = self.store.query(Project).all()

        projects_being_built = [int(project_id) for project_id in ctx.projects_being_built]
        results = []
        for project in projects:
            result = {}
            result['id'] = project.id
            result['name'] = project.name


            if project.id in projects_being_built:
                result['execution_status'] = "BUILDING"
            else:
                result['execution_status'] = "BUILT"

            if project.last_build is not None:
                result['status'] = project.last_build.status
                result['author'] = project.last_build.commit_author
                result['email'] = template_filters.email(project.last_build.commit_author)
                result['gravatar'] = template_filters.gravatar(project.last_build.commit_author)

                commit_text = project.last_build.commit_text[:50]
                if len(project.last_build.commit_text) > 50:
                    commit_text = commit_text + "..."

                result['commit_text'] = commit_text
            else:
                result['status'] = 'UNKNOWN'

            results.append(result)
        return demjson.encode(results)
def test_convert_author_name_whit_two_mails_to_gravatar():
    gravatar_link = 'http://gravatar.com/avatar/1de5f26601d08d1cabe742f8efd55d4e'
    author_name = 'Evandro Flores <*****@*****.**> Pairing with Ni Knight <*****@*****.**>'
    

    assert template_filters.gravatar(author_name) == gravatar_link
def test_convert_empty_to_gravatar():
    gravatar_link = 'http://gravatar.com/avatar/'
    author_name = ''

    assert template_filters.gravatar(author_name) == gravatar_link
def test_convert_author_name_to_gravatar():
    gravatar_link = 'http://gravatar.com/avatar/34f8d85f596bd2e1edaf20a777cabc66'
    author_name = 'Evandro Flores <*****@*****.**>'

    assert template_filters.gravatar(author_name) == gravatar_link