Python hamcrest.starts_with() Examples

The following are 7 code examples of hamcrest.starts_with(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module hamcrest , or try the search function .
Example #1
Source File: profile.py    From selene-backend with GNU Affero General Public License v3.0 5 votes vote down vote up
def validate_monthly_account(context):
    acct_repository = AccountRepository(context.db)
    membership = acct_repository.get_active_account_membership(
        context.accounts['foo'].id
    )
    assert_that(
        membership.type,
        equal_to(MONTHLY_MEMBERSHIP)
    )
    assert_that(membership.payment_account_id, starts_with('cus'))
    assert_that(membership.start_date, equal_to(date.today()))
    assert_that(membership.end_date, none()) 
Example #2
Source File: profile.py    From selene-backend with GNU Affero General Public License v3.0 5 votes vote down vote up
def yearly_account(context):
    acct_repository = AccountRepository(context.db)
    membership = acct_repository.get_active_account_membership(
        context.accounts['foo'].id
    )
    assert_that(membership.type, equal_to(YEARLY_MEMBERSHIP))
    assert_that(membership.payment_account_id, starts_with('cus')) 
Example #3
Source File: terminal_client_test.py    From netman with Apache License 2.0 5 votes vote down vote up
def test_connect_timeout(self):
        with self.assertRaises(ConnectTimeout) as expect:
            self.client("10.0.0.0", "whatever", "whatever", connect_timeout=1)

        assert_that(str(expect.exception), starts_with("Timed out while connecting to 10.0.0.0 on port")) 
Example #4
Source File: test_type_resource.py    From storops with Apache License 2.0 5 votes vote down vote up
def test_get_type_fields(self):
        t = UnityType(_id='type')
        assert_that(t.fields_str, starts_with(
            'name,description,documentation,type,attributes.name')) 
Example #5
Source File: test_type_resource.py    From storops with Apache License 2.0 5 votes vote down vote up
def test_fields_str(self):
        t = UnityType(_id='lun', cli=t_rest())
        assert_that(t.fields_str, starts_with('auSize,creationTime,')) 
Example #6
Source File: test_main.py    From fake-switches with Apache License 2.0 5 votes vote down vote up
def test_fake_switches_entrypoint_cisco_generic(self):
        p = subprocess.Popen(get_base_args() + ["--listen-host", TEST_BIND_HOST,
                                                "--listen-port", TEST_BIND_PORT])
        time.sleep(1)
        handshake = connect_and_read_bytes(TEST_BIND_HOST, TEST_BIND_PORT,
                                           byte_count=8, retry_count=10)

        p.terminate()

        assert_that(handshake, starts_with('SSH-2.0')) 
Example #7
Source File: report.py    From allure-python with Apache License 2.0 5 votes vote down vote up
def has_test_case(name, *matchers):
    return has_property('test_cases',
                        has_item(
                            all_of(
                                any_of(
                                    has_entry('fullName', ends_with(name)),
                                    has_entry('name', starts_with(name))
                                ),
                                *matchers
                            )
                        )
                        )