Esempio n. 1
0
 def test_unpack_scope_with_query_and_projection(self):
     bldr = ScopeBuilder(Mock(), [])
     query, projection, options = bldr.unpack_scope(({
         "thing": "blah"
     }, {
         "thing": 1
     }))
     self.assertEqual({"thing": "blah"}, query)
     self.assertEqual({"thing": 1}, projection)
     self.assertEqual({}, options)
Esempio n. 2
0
    def test_unpack_scope_too_many_args(self):
        bldr = ScopeBuilder(Mock(), [])

        with self.assertRaises(ValueError):
            bldr.unpack_scope(({}, {}, {}, {}))
Esempio n. 3
0
    def test_unpack_scope_missing_no_data(self):
        bldr = ScopeBuilder(Mock(), [])

        with self.assertRaises(ValueError):
            bldr.unpack_scope(None)
Esempio n. 4
0
 def test_unpack_scope_with_all_options(self):
     bldr = ScopeBuilder(Mock(), [])
     query, projection, options = bldr.unpack_scope(({"thing": "blah"}, {"thing": 1}, {"limit": 5}))
     self.assertEqual({"thing": "blah"}, query)
     self.assertEqual({"thing": 1}, projection)
     self.assertEqual({"limit": 5}, options)
Esempio n. 5
0
 def test_unpack_scope_with_just_query(self):
     bldr = ScopeBuilder(Mock(), [])
     query, projection, options = bldr.unpack_scope({"thing": "blah"})
     self.assertEqual({"thing": "blah"}, query)
     self.assertEqual({}, projection)
     self.assertEqual({}, options)
Esempio n. 6
0
    def test_unpack_scope_too_many_args(self):
        bldr = ScopeBuilder(Mock(), [])

        with self.assertRaises(ValueError):
            bldr.unpack_scope(({}, {}, {}, {}))
Esempio n. 7
0
    def test_unpack_scope_missing_no_data(self):
        bldr = ScopeBuilder(Mock(), [])

        with self.assertRaises(ValueError):
            bldr.unpack_scope(None)