Exemplo n.º 1
0
    def test_can_create_facts(self):
        fact = FactFactory.create(key=Key(name="some.random.fact"), value="whatever")

        loaded_fact = self.db.query(Fact).get(fact.id)

        expect(loaded_fact.key.name).to_equal("some.random.fact")
        expect(loaded_fact.value).to_equal("whatever")
Exemplo n.º 2
0
    def test_can_create_facts(self):
        fact = FactFactory.create(key=Key(name='some.random.fact'),
                                  value='whatever')

        loaded_fact = self.db.query(Fact).get(fact.id)

        expect(loaded_fact.key.name).to_equal('some.random.fact')
        expect(loaded_fact.value).to_equal('whatever')
Exemplo n.º 3
0
    def test_to_dict(self):
        fact = FactFactory.create(key=Key(name="some.random.fact"), value="whatever")

        facts_definitions = {"some.random.fact": {}}

        expect(fact.to_dict(facts_definitions, _)).to_be_like(
            {"key": "some.random.fact", "value": "whatever", "unit": "value", "title": "unknown", "category": "unknown"}
        )
Exemplo n.º 4
0
    def test_fact_str(self):
        fact = FactFactory.create(
            key=Key(name="some.random.fact"),
            value=1203,
        )

        loaded_fact = self.db.query(Fact).get(fact.id)

        expect(str(loaded_fact)).to_be_like('some.random.fact: 1203')
Exemplo n.º 5
0
    def test_fact_str(self):
        fact = FactFactory.create(
            key=Key(name="some.random.fact"),
            value=1203,
        )

        loaded_fact = self.db.query(Fact).get(fact.id)

        expect(str(loaded_fact)).to_be_like('some.random.fact: 1203')
Exemplo n.º 6
0
    def test_to_dict(self):
        fact = FactFactory.create(
            key=Key(name='some.random.fact'),
            value='whatever',
        )

        facts_definitions = {'some.random.fact': {}}

        expect(fact.to_dict(facts_definitions)).to_be_like({
            'key': 'some.random.fact',
            'value': 'whatever',
            'unit': 'value',
            'title': 'unknown',
            'category': 'unknown'
        })
Exemplo n.º 7
0
    def test_to_dict(self):
        fact = FactFactory.create(
            key=Key(name='some.random.fact'),
            value='whatever',
        )

        facts_definitions = {'some.random.fact': {}}

        expect(fact.to_dict(facts_definitions, _)).to_be_like({
            'key':
            'some.random.fact',
            'value':
            'whatever',
            'unit':
            'value',
            'title':
            'unknown',
            'category':
            'unknown'
        })