Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a way to extend sure #31

Closed
gabrielfalcao opened this issue Apr 24, 2013 · 5 comments
Closed

Provide a way to extend sure #31

gabrielfalcao opened this issue Apr 24, 2013 · 5 comments

Comments

@gabrielfalcao
Copy link
Owner

So that the code below is valid:

from sure import assertion, chain, chainproperty
from lxml import html


@assertion
def attribute(parent, is_negative, name):  # *args, **kw FTW
    if is_negative:
        return name not in parent.object.attrib
    else:
        return name in parent.object.attrib

@chain
def child(parent, name):  # *args, **kw FTW
    items = parent.object.cssselect(name)
    items.should.have.length_of(1)

    return items[0]

@chainproperty
def having(parent):
    return parent.object

def test_anchors_in_1st_level_headers():
    headers = dom.cssselect("h1")

    headers.should.have.length_of()

    h1 = headers[0]

    h1.should.have.attribute("name").being.equal("api-reference")
    h1.should.have.child("a").having.attribute("href").equal("#api-reference")
@fgimian
Copy link

fgimian commented Apr 1, 2014

Hey Gabriel, great library! 😄

This would be my number one feature request too as I would like to extend sure for testing web applications.

e.g.

response = self.client.get('/')
response.should.render_template('index.html')
response.should.return_code(200)
response.should.contain('welcome to my homepage')

Do you think that you would be able to support such functionality in the near future?

Thanks heaps!
Fotis

@timofurrer timofurrer modified the milestone: 1.4.0 Jun 21, 2016
@timofurrer timofurrer self-assigned this Jun 22, 2016
timofurrer added a commit that referenced this issue Jun 29, 2016
Provide possibility to extend sure. Refs #31
@timofurrer
Copy link
Collaborator

Some basic stuff is already merged to achieve this functionality. However, the PR #117 has some open points which I want to address in the future.

@timofurrer timofurrer removed this from the 1.4.0 milestone Sep 15, 2016
@timofurrer
Copy link
Collaborator

Reminder: Document this stuff!

@timofurrer timofurrer added this to the 1.4.1 milestone Feb 10, 2017
@timofurrer
Copy link
Collaborator

Documented with: 4e41290

@timofurrer
Copy link
Collaborator

I'm going to close this issue for now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants