Beispiel #1
0
    def test_get_output_with_dict(self):
        output = {'merge': 'bla', 'db_alias': 'default'}
        collection = self.test_doc._get_collection()
        qs = QuerySet(self.test_doc, collection)

        ret = qs._get_output(output)
        self.assertIsInstance(ret, SON)
Beispiel #2
0
    def test_get_output_with_str(self):
        collection = self.test_doc._get_collection()
        qs = QuerySet(self.test_doc, collection)

        ret = qs._get_output('outcoll')

        self.assertEqual(ret, 'outcoll')
Beispiel #3
0
    def test_get_output_with_son(self):
        collection = self.test_doc._get_collection()
        qs = QuerySet(self.test_doc, collection)

        son = SON({'merge': 'bla'})
        ret = qs._get_output(son)

        self.assertEqual(ret, son)
Beispiel #4
0
    def test_get_output_with_bad_output_type(self):
        collection = self.test_doc._get_collection()
        qs = QuerySet(self.test_doc, collection)

        with self.assertRaises(ConfusionError):
            qs._get_output([])
Beispiel #5
0
    def test_get_output_without_action_data(self):
        collection = self.test_doc._get_collection()
        qs = QuerySet(self.test_doc, collection)

        with self.assertRaises(OperationError):
            qs._get_output({})