def test_add_term(self) -> None: """Test QueryBase.add_term()""" query = census.QueryBase() query.add_term('field', 'value') term = query.data.terms[0] self.assertEqual(term.field, 'field') self.assertEqual(term.value, 'value') self.assertEqual(term.modifier, census.SearchModifier.EQUAL_TO)
def test_add_join(self) -> None: """Test QueryBase.add_join()""" query = census.QueryBase('collection') join = census.JoinedQuery('join') query.add_join(join) # The joins cannot be compared directly as the add_join method creates # a copy of the join. self.assertDictEqual(query.joins[0].__dict__, join.__dict__)
def test_show(self) -> None: """Test QueryBase.show()""" query = census.QueryBase('collection') self.assertListEqual(query.data.show, []) query.show('one', 'two') self.assertListEqual(query.data.show, ['one', 'two'])
def test_hide(self) -> None: """Test QueryBase.hide()""" query = census.QueryBase('collection') self.assertListEqual(query.data.hide, []) query.hide('one', 'two') self.assertListEqual(query.data.hide, ['one', 'two'])
def test_create_join(self) -> None: """Test QueryBase.create_join()""" query = census.QueryBase('collection') join = query.create_join('join') self.assertListEqual(query.joins, [join])