Пример #1
0
def step_impl(context, text):
    expect(browser.html).to(match(text))
Пример #2
0
 def expect_output_lines_to_have_a_date(self):
     for line in self.execution_result.lines_in_output:
         expect(line).to(match(self.DATE_PATTERN))
Пример #3
0
 def expect_output_lines_to_have_an_url(self):
     for line_number, line in enumerate(self.execution_result.lines_in_output):
         url = self.saved_links[line_number][0]
         expect(line).to(match(url))
Пример #4
0
 def expect_output_lines_to_have_an_id(self):
     for line in self.execution_result.lines_in_output:
         expect(line).to(match(self.NUMBER_AT_BEGINNING_OF_LINE_PATTERN))
Пример #5
0
            with context('output lines'):
                with it('have an id'):
                    self.expect_output_lines_to_have_an_id()

                with it('have an URL'):
                    self.expect_output_lines_to_have_an_url()

                with it('have a date'):
                    self.expect_output_lines_to_have_a_date()

                with it('have no tags'):
                    for line_number, line in enumerate(self.execution_result.lines_in_output):
                        tag = self.saved_links[line_number][1]

                        expect(line).not_to(match(tag))
                        expect(line).not_to(match(self.tag_filter))

        def expect_output_lines_to_have_an_id(self):
            for line in self.execution_result.lines_in_output:
                expect(line).to(match(self.NUMBER_AT_BEGINNING_OF_LINE_PATTERN))

        def expect_output_lines_to_have_an_url(self):
            for line_number, line in enumerate(self.execution_result.lines_in_output):
                url = self.saved_links[line_number][0]
                expect(line).to(match(url))

        def expect_output_lines_to_have_a_date(self):
            for line in self.execution_result.lines_in_output:
                expect(line).to(match(self.DATE_PATTERN))
Пример #6
0
            with failure('is a file'):
                expect(c.AN_EXISTENT_FILE_PATH).to(be_a_directory)

        with it('fails if path does not exist'):
            with failure('does not exist'):
                expect(c.A_NOT_EXISTENT_PATH).to(be_a_directory)

    with describe('have_owner'):
        with it('passes if file exists and has owner'):
            expect(c.AN_EXISTENT_FILE_PATH).to(have_owner(c.AN_EXISTENT_FILE_OWNER))

        with it('passes if directory exists and has owner'):
            expect(c.AN_EXISTENT_DIRECTORY_PATH).to(have_owner(c.AN_EXISTENT_DIRECTORY_OWNER))

        with it('passes if file exists and owner matches'):
            expect(c.AN_EXISTENT_FILE_PATH).to(have_owner(match('\w+')))

        with it('fails if file exists and does not have owner'):
            with failure:
                expect(c.AN_EXISTENT_FILE_PATH).to(have_owner(c.AN_EXISTENT_FILE_INVALID_OWNER))

        with it('fails if file does not exist'):
            with failure('does not exist'):
                expect(c.A_NOT_EXISTENT_PATH).to(have_owner(c.AN_EXISTENT_FILE_OWNER))

        with it('fails if directory exists and does not have owner'):
            with failure:
                expect(c.AN_EXISTENT_DIRECTORY_PATH).to(have_owner(c.AN_EXISTENT_DIRECTORY_INVALID_OWNER))

        with it('fails if file exists and owner does not match'):
            with failure: