def test_should_convert_correctly_with_nanos(self): for t in self.NANO_TESTS: dt, nanos = timestamp.from_rfc3339(t[0], with_nanos=True) expect(dt).to(equal(t[1][0])) epsilon = abs(nanos - t[1][1]) # expect(epsilon).to(equal(0)) expect(epsilon).to(be_below_or_equal(self.TOLERANCE))
def _match(self, result): expect(result).to(be_a(client.models.CpuGeneratorResult)) expect(result.id).not_to(be_empty) expect(result.generator_id).not_to(be_empty) expect(result.active).to(be_a(bool)) expect(result.timestamp_first).not_to(be_none) expect(result.timestamp_last).not_to(be_none) expect(result.timestamp_first).to(be_below_or_equal(result.timestamp_last)) expect(result.stats).to(be_a(client.models.CpuGeneratorStats)) return True, ['is valid CPU Generator Result']
def _match(self, result): expect(result).to(be_a(client.models.BlockGeneratorResult)) expect(result.id).not_to(be_empty) expect(result.generator_id).not_to(be_empty) expect(result.active).not_to(be_none) expect(result.timestamp_first).not_to(be_none) expect(result.timestamp_last).not_to(be_none) expect(result.timestamp_first).to(be_below_or_equal(result.timestamp_last)) expect(result.read).to(be_a(client.models.BlockGeneratorStats)) expect(result.write).to(be_a(client.models.BlockGeneratorStats)) return True, ['is valid block generator result']
with it('does not set any url'): finding = self.mapper.create_from(fixtures.event_falco()) expect(finding.url).to(be_none) with context('when checking the finding_id'): with it('uses an uuid as id'): finding = self.mapper.create_from(fixtures.event_falco()) expect(finding.finding_id).to(be_an_uuid()) with it('uses a shorter value than allowed by Google'): finding = self.mapper.create_from(fixtures.event_falco()) expect(finding.finding_id).to(have_len(be_below_or_equal(32))) with it('has a resource name empty'): finding = self.mapper.create_from(fixtures.event_falco()) expect(finding.resource_name).to(be_the_organization_resource_name()) with it('adds output'): output = "A shell was spawned in a container with an attached terminal (user=root unruffled_hamilton (id=32c415f00958) shell=bash parent=<NA> cmdline=bash terminal=34816)" finding = self.mapper.create_from(fixtures.event_falco()) expect(finding.summary).to(equal(output)) with it('adds priority'): finding = self.mapper.create_from(fixtures.event_falco())
def test_returns_false_if_other_is_not_empty_fake(self): expect(EmptyFake()).not_to(be_below_or_equal(42))
def test_le_returns_true_if_other_is_empty_fake(self): expect(EmptyFake()).to(be_below_or_equal(EmptyFake()))