Python hamcrest.greater_than() Examples

The following are 13 code examples of hamcrest.greater_than(). 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: test_enabled_with_commit_delay.py    From fake-switches with Apache License 2.0 6 votes vote down vote up
def test_write_memory_with_delay(self, t):
        t.child.timeout = 10
        enable(t)

        t.write("copy running-config startup-config")

        t.readln("")
        t.readln("This operation may take a few minutes.")
        t.readln("Management interfaces will not be available during this time.")
        t.readln("")
        t.read("Are you sure you want to save? (y/n) ")
        start_time = time()
        t.write_raw("y")
        t.readln("")
        t.readln("")
        t.readln("Configuration Saved!")
        end_time = time()
        t.read("my_switch#")

        assert_that((end_time - start_time), greater_than(COMMIT_DELAY)) 
Example #2
Source File: duration_time_test.py    From allure-python with Apache License 2.0 6 votes vote down vote up
def test_duration(allured_testdir, snipped):
    allured_testdir.testdir.makepyfile("""
        def test_duration_example():
            {snipped}
    """.format(snipped=snipped))

    timestamp = now()
    allured_testdir.run_with_allure()

    assert_that(allured_testdir.allure_report,
                has_test_case("test_duration_example",
                              all_of(
                                  has_entry("start", greater_than(timestamp)),
                                  has_entry("stop", greater_than(timestamp))
                              ))
                ) 
Example #3
Source File: duration_time_test.py    From allure-python with Apache License 2.0 6 votes vote down vote up
def test_with_fixture_duration(allured_testdir, snipped):
    allured_testdir.testdir.makepyfile("""
        import pytest

        @pytest.fixture
        def fixture():
            {snipped}

        def test_with_fixture_duration_example(fixture):
            pass
    """.format(snipped=snipped))

    timestamp = now()
    allured_testdir.run_with_allure()

    assert_that(allured_testdir.allure_report,
                has_test_case("test_with_fixture_duration_example",
                              all_of(
                                  has_entry("start", greater_than(timestamp)),
                                  has_entry("stop", greater_than(timestamp))
                              ))
                ) 
Example #4
Source File: duration_time_test.py    From allure-python with Apache License 2.0 6 votes vote down vote up
def test_with_fixture_finalizer_duration(allured_testdir, snipped):
    allured_testdir.testdir.makepyfile("""
        import pytest

        @pytest.fixture
        def fixture(request):
            def finalizer():
                {snipped}
            request.addfinalizef(finalizer)

        def test_with_fixture_finalizer_duration(fixture):
            pass
    """.format(snipped=snipped))

    timestamp = now()
    allured_testdir.run_with_allure()

    assert_that(allured_testdir.allure_report,
                has_test_case("test_with_fixture_finalizer_duration",
                              all_of(
                                  has_entry("start", greater_than(timestamp)),
                                  has_entry("stop", greater_than(timestamp))
                              ))
                ) 
Example #5
Source File: get_versions_test.py    From netman with Apache License 2.0 5 votes vote down vote up
def test_returns_a_dictionary_of_various_hardware_and_software_versions(self):
        versions = self.client.get_versions()

        assert_that(isinstance(versions, dict))
        assert_that(len(versions), greater_than(0)) 
Example #6
Source File: test_system.py    From storops with Apache License 2.0 5 votes vote down vote up
def test_feature_list():
    feature = vnx.get_pool_feature()
    assert_that(feature.existed, equal_to(True))
    assert_that(len(feature.available_disks), greater_than(0)) 
Example #7
Source File: test_get_issues.py    From youtrack with MIT License 5 votes vote down vote up
def test_get_issue_comments(self):
        self.connection = TestGetIssues.connection
        project = os.getenv('TEST_PROJECT', '')
        issues = self.connection.get_issues(project, 'for: me #unresolved', 0, 10)
        pprint.PrettyPrinter(indent=0).pprint(issues)
        count = 0
        for issue in issues:
            comments = issue.get_comments()
            pprint.PrettyPrinter(indent=4).pprint(comments)
            count += len(comments)

        assert_that(count, is_(greater_than(0))) 
Example #8
Source File: test_get_issues.py    From youtrack with MIT License 5 votes vote down vote up
def test_get_issue_attachments(self):
        self.connection = TestGetIssues.connection
        project = os.getenv('TEST_PROJECT', '')
        issues = self.connection.get_issues(project, 'for: me #unresolved', 0, 10)
        pprint.PrettyPrinter(indent=0).pprint(issues)
        count = 0
        for issue in issues:
            attachments = issue.get_attachments()
            pprint.PrettyPrinter(indent=4).pprint(attachments)
            count += len(attachments)

        assert_that(count, is_(greater_than(0))) 
Example #9
Source File: test_get_issues.py    From youtrack with MIT License 5 votes vote down vote up
def test_get_issue_attachments_content(self):
        self.connection = TestGetIssues.connection
        project = os.getenv('TEST_PROJECT', '')
        issues = self.connection.get_issues(project, 'for: me #unresolved', 0, 10)
        pprint.PrettyPrinter(indent=0).pprint(issues)
        count = 0
        for issue in issues:
            # attachments = issue.get_attachments()
            attachments = self.connection.get_attachments(issue['id'])
            pprint.PrettyPrinter(indent=4).pprint(attachments)
            for attachment in attachments:
                content = attachment.get_content()
                count += content.length

        assert_that(count, is_(greater_than(0))) 
Example #10
Source File: test_brocade_switch_protocol_with_commit_delay.py    From fake-switches with Apache License 2.0 5 votes vote down vote up
def test_write_memory(self, t):
        enable(t)
        t.child.timeout = 10

        start_time = time.time()

        t.write("write memory")
        t.read("SSH@my_switch#")

        end_time = time.time()

        assert_that((end_time - start_time), greater_than(COMMIT_DELAY)) 
Example #11
Source File: test_cisco_switch_protocol_with_commit_delay.py    From fake-switches with Apache License 2.0 5 votes vote down vote up
def test_write_memory_with_commit_delay(self, t):
        t.child.timeout = 10
        enable(t)
        start_time = time()
        t.write("write memory")
        t.readln("Building configuration...")
        t.readln("OK")
        t.read("my_switch#")
        end_time = time()

        assert_that((end_time - start_time), greater_than(COMMIT_DELAY)) 
Example #12
Source File: test_arista_switch_protocol_with_commit_delay.py    From fake-switches with Apache License 2.0 5 votes vote down vote up
def test_write_memory_with_commit_delay(self, t):
        t.child.timeout = 10
        enable(t)
        start_time = time()
        t.write("write memory")
        t.readln("Copy completed successfully.")
        t.read("my_arista#")
        end_time = time()

        assert_that((end_time - start_time), greater_than(COMMIT_DELAY)) 
Example #13
Source File: juniper_base_protocol_with_commit_delay_test.py    From fake-switches with Apache License 2.0 5 votes vote down vote up
def test_lock_edit_candidate_add_vlan_and_commit_with_commit_delay(self):
        with self.nc.locked(target='candidate'):
            result = self.nc.edit_config(target='candidate', config=dict_2_etree({
                "config": {
                    "configuration": {
                        "vlans": {
                            "vlan": {
                                "name": "VLAN2999",
                                }
                        }
                    }
                }}))
            assert_that(result.xpath("//rpc-reply/ok"), has_length(1))

            result = self.nc.commit()
            assert_that(result.xpath("//rpc-reply/ok"), has_length(1))

        result = self.nc.get_config(source="running")

        assert_that(result.xpath("data/configuration/vlans/vlan"), has_length(1))

        self.edit({
            "vlans": {
                "vlan": {
                    XML_ATTRIBUTES: {"operation": "delete"},
                    "name": "VLAN2999"
                }
            }
        })

        start_time = time()
        self.nc.commit()
        end_time = time()

        result = self.nc.get_config(source="running")

        assert_that(result.xpath("data/configuration/vlans/vlan"), has_length(0))
        assert_that((end_time - start_time), greater_than(COMMIT_DELAY))