Example #1
0
def test_update():
    spec = SON([
        ("update", u"songs"),
        ("ordered", True),
        (
            "updates",
            [
                SON([
                    ("q", {
                        "artist": "Neil"
                    }),
                    ("u", {
                        "$set": {
                            "artist": "Shakey"
                        }
                    }),
                    ("multi", True),
                    ("upsert", False),
                ])
            ],
        ),
    ])
    cmd = parse_spec(spec)
    assert cmd.name == "update"
    assert cmd.coll == "songs"
    assert cmd.query == {"artist": "Neil"}
Example #2
0
def test_insert():
    spec = SON([
        ('insert', 'bla'),
        ('ordered', True),
        ('documents', ['a', 'b']),
    ])
    cmd = parse_spec(spec)
    eq_(cmd.name, "insert")
    eq_(cmd.coll, "bla")
    eq_(cmd.tags, {'mongodb.ordered': True})
    eq_(cmd.metrics, {'mongodb.documents': 2})
Example #3
0
def test_insert():
    spec = SON([
        ('insert', 'bla'),
        ('ordered', True),
        ('documents', ['a', 'b']),
    ])
    cmd = parse_spec(spec)
    eq_(cmd.name, "insert")
    eq_(cmd.coll, "bla")
    eq_(cmd.tags, {'mongodb.ordered':True})
    eq_(cmd.metrics, {'mongodb.documents':2})
Example #4
0
def test_insert():
    spec = SON([
        ('insert', 'bla'),
        ('ordered', True),
        ('documents', ['a', 'b']),
    ])
    cmd = parse_spec(spec)
    assert cmd.name == 'insert'
    assert cmd.coll == 'bla'
    assert cmd.tags == {'mongodb.ordered': True}
    assert cmd.metrics == {'mongodb.documents': 2}
Example #5
0
def test_insert():
    spec = SON([
        ("insert", "bla"),
        ("ordered", True),
        ("documents", ["a", "b"]),
    ])
    cmd = parse_spec(spec)
    assert cmd.name == "insert"
    assert cmd.coll == "bla"
    assert cmd.tags == {"mongodb.ordered": True}
    assert cmd.metrics == {"mongodb.documents": 2}
Example #6
0
def test_update():
    spec = SON([('update', u'songs'), ('ordered', True),
                ('updates', [
                    SON([('q', {
                        'artist': 'Neil'
                    }), ('u', {
                        '$set': {
                            'artist': 'Shakey'
                        }
                    }), ('multi', True), ('upsert', False)])
                ])])
    cmd = parse_spec(spec)
    eq_(cmd.name, "update")
    eq_(cmd.coll, "songs")
    eq_(cmd.query, {'artist': 'Neil'})
Example #7
0
def test_update():
    spec = SON([('update', u'songs'), ('ordered', True),
                ('updates', [
                    SON([('q', {
                        'artist': 'Neil'
                    }), ('u', {
                        '$set': {
                            'artist': 'Shakey'
                        }
                    }), ('multi', True), ('upsert', False)])
                ])])
    cmd = parse_spec(spec)
    assert cmd.name == 'update'
    assert cmd.coll == 'songs'
    assert cmd.query == {'artist': 'Neil'}
Example #8
0
def test_update():
    spec = SON([
        ('update', u'songs'),
        ('ordered', True),
        ('updates', [
            SON([
                ('q', {'artist': 'Neil'}),
                ('u', {'$set': {'artist': 'Shakey'}}),
                ('multi', True),
                ('upsert', False)
            ])
        ])
    ])
    cmd = parse_spec(spec)
    eq_(cmd.name, "update")
    eq_(cmd.coll, "songs")
    eq_(cmd.query, {'artist':'Neil'})
Example #9
0
def test_create():
    cmd = parse_spec(SON([("create", "foo")]))
    eq_(cmd.name, "create")
    eq_(cmd.coll, "foo")
    eq_(cmd.tags, {})
    eq_(cmd.metrics, {})
Example #10
0
def test_empty():
    cmd = parse_spec(SON([]))
    assert cmd is None
Example #11
0
def test_create():
    cmd = parse_spec(SON([("create", "foo")]))
    eq_(cmd.name, "create")
    eq_(cmd.coll, "foo")
    eq_(cmd.tags, {})
    eq_(cmd.metrics ,{})
Example #12
0
def test_empty():
    cmd = parse_spec(SON([]))
    assert cmd is None
Example #13
0
def test_create():
    cmd = parse_spec(SON([('create', 'foo')]))
    assert cmd.name == 'create'
    assert cmd.coll == 'foo'
    assert cmd.tags == {}
    assert cmd.metrics == {}
Example #14
0
def test_create():
    cmd = parse_spec(SON([("create", "foo")]))
    assert cmd.name == "create"
    assert cmd.coll == "foo"
    assert cmd.tags == {}
    assert cmd.metrics == {}
Example #15
0
def test_create():
    cmd = parse_spec(SON([('create', 'foo')]))
    eq_(cmd.name, 'create')
    eq_(cmd.coll, 'foo')
    eq_(cmd.tags, {})
    eq_(cmd.metrics, {})