Esempio n. 1
0
def test_add():
    global id
    if main.fb_app is None:
        main.defineConfigs()
    t = marca.add(Marca("teste"))
    id = t._id
    assert type(t) is Marca
def test_add():
	global id
	if main.fb_app is None:
		main.defineConfigs()
	t = modelo.add(Modelo(Marca(""), Arquitetura("", 0), 2020, "teste"))
	id = t._id
	assert type(t) is Modelo
Esempio n. 3
0
def change(event):
    global marcas
    global etag
    if etag == None:
        ret = db.reference('/marcas').get(etag=True)
        etag = ret[1]
        for key, item in ret[0].items():
            marca = Marca.fromJSON(item, key)
            marcas.update({key: marca})
    else:
        ret = db.reference('/marcas').get_if_changed(etag)
        if ret[0]:
            etag = ret[2]
            marcas.clear()
            for key, item in ret[1].items():
                marca = Marca.fromJSON(item, key)
                marcas.update({key: marca})
Esempio n. 4
0
def test_upd():
    if main.fb_app is None:
        main.defineConfigs()
    if id is None:
        test_add()
    t = marca.upd(Marca("testa atualizado", id))
    test_rmv()
    assert type(t) is Marca
def test_upd():
	if main.fb_app is None:
		main.defineConfigs()
	if id is None:
		test_add()
	t = modelo.upd(
	    Modelo(Marca(""), Arquitetura("", 0), 2020, "teste atualizado", id))
	test_rmv()
	assert type(t) is Modelo
def test_fetchPreco():
    if main.fb_app is None:
        main.defineConfigs()
    l = Loja("Kabum", "meta", "itemprop", "price")
    l = rep_loja.add(l)
    l = rep_loja.getById(l._id)
    p = Produto(
        l,
        Variacao(Modelo(Marca(""), Arquitetura("", 0), 2020, "teste"),
                 "AMD Ryzen 5 1600"),
        "https://www.kabum.com.br/produto/107545/processador-amd-ryzen-5-1600-cache-19mb-3-2ghz-3-6ghz-max-turbo-am4-yd1600bbafbox"
    )
    p = rep_produto.add(p)
    p = rep_produto.getById(p._id)
    preco = req.fetchPreco(p)
    assert type(preco) is Produto
Esempio n. 7
0
def test_rmv():
    if main.fb_app is None:
        main.defineConfigs()
    if id is None:
        test_add()
    assert marca.rmv(Marca("", id)) is None
def test_rmv():
	if main.fb_app is None:
		main.defineConfigs()
	if id is None:
		test_add()
	assert modelo.rmv(Modelo(Marca(""), Arquitetura("", 0), 0, "", id)) is None