Пример #1
0
 def test_sucesso(self):
     usuario = Usuario(nome='Teste', email='*****@*****.**', google_id='123', admin=False)
     usuario.put()
     usuarios = [usuario]
     resposta_mock = Mock()
     crud.usuario_listar(resposta_mock)
     resposta_mock.assert_called_once_with('/templates/usuario_listar.html', {'lista_usuarios': usuarios})
Пример #2
0
 def test_sucesso(self):
     cardapio = Cardapios(lanche='Teste', ingrediente='Teste', valor='1,99')
     cardapio.put()
     cardapios = [cardapio]
     resposta_mock = Mock()
     crud.cardapio_listar(resposta_mock)
     resposta_mock.assert_called_once_with(
         '/templates/cardapio_listar.html', {'lista_cardapios': cardapios})
Пример #3
0
 def test_sucesso(self):
     usuario = Usuario(nome='Teste',
                       email='*****@*****.**',
                       google_id='123',
                       admin=False)
     usuario.put()
     usuarios = [usuario]
     resposta_mock = Mock()
     crud.usuario_listar(resposta_mock)
     resposta_mock.assert_called_once_with('/templates/usuario_listar.html',
                                           {'lista_usuarios': usuarios})
Пример #4
0
 def test_sucesso(self):
     handler = Mock()
     home.index(handler)
     handler.assert_called_once_with('/templates/index.html')
Пример #5
0
 def test_sucesso(self):
     resposta_mock = Mock()
     crud.novo_lanche(resposta_mock)
     resposta_mock.assert_called_once_with('/templates/novo_lanche.html')
Пример #6
0
 def test_vitrine(self):
     resposta_mock = Mock()
     crud.vitrine(resposta_mock)
     resposta_mock.assert_called_once_with('/templates/shop.html')
Пример #7
0
 def test_cadastrar_produto(self):
     resposta_mock = Mock()
     crud.cadastrar_produto(resposta_mock)
     resposta_mock.assert_called_once_with('/templates/add_product.html')
def test_jumpstart_models_cache_set_reset_fxs(mock_model_cache: Mock):

    # test change of region resets cache
    accessors.JumpStartModelsAccessor.get_model_header(
        region="us-west-2", model_id="pytorch-ic-mobilenet-v2", version="*")

    accessors.JumpStartModelsAccessor.get_model_specs(
        region="us-west-2", model_id="pytorch-ic-mobilenet-v2", version="*")

    mock_model_cache.assert_called_once()
    mock_model_cache.reset_mock()

    accessors.JumpStartModelsAccessor.get_model_header(
        region="us-east-2", model_id="pytorch-ic-mobilenet-v2", version="*")

    mock_model_cache.assert_called_once()
    mock_model_cache.reset_mock()

    accessors.JumpStartModelsAccessor.get_model_specs(
        region="us-west-1", model_id="pytorch-ic-mobilenet-v2", version="*")
    mock_model_cache.assert_called_once()
    mock_model_cache.reset_mock()

    # test set_cache_kwargs
    accessors.JumpStartModelsAccessor.set_cache_kwargs(
        cache_kwargs={"some": "kwarg"})
    mock_model_cache.assert_called_once_with(some="kwarg")
    mock_model_cache.reset_mock()

    accessors.JumpStartModelsAccessor.set_cache_kwargs(
        region="us-west-2", cache_kwargs={"some": "kwarg"})
    mock_model_cache.assert_called_once_with(region="us-west-2", some="kwarg")
    mock_model_cache.reset_mock()

    # test reset cache
    accessors.JumpStartModelsAccessor.reset_cache(
        cache_kwargs={"some": "kwarg"})
    mock_model_cache.assert_called_once_with(some="kwarg")
    mock_model_cache.reset_mock()

    accessors.JumpStartModelsAccessor.reset_cache(
        region="us-west-2", cache_kwargs={"some": "kwarg"})
    mock_model_cache.assert_called_once_with(region="us-west-2", some="kwarg")
    mock_model_cache.reset_mock()

    accessors.JumpStartModelsAccessor.reset_cache()
    mock_model_cache.assert_called_once_with()
    mock_model_cache.reset_mock()

    # validate region and cache kwargs utility
    assert {
        "some": "kwarg"
    } == accessors.JumpStartModelsAccessor._validate_and_mutate_region_cache_kwargs(
        {"some": "kwarg"}, "us-west-2")
    assert {
        "some": "kwarg"
    } == accessors.JumpStartModelsAccessor._validate_and_mutate_region_cache_kwargs(
        {
            "some": "kwarg",
            "region": "us-west-2"
        }, "us-west-2")

    with pytest.raises(ValueError):
        accessors.JumpStartModelsAccessor._validate_and_mutate_region_cache_kwargs(
            {
                "some": "kwarg",
                "region": "us-east-2"
            }, "us-west-2")

    # necessary because accessors is a static module
    reload(accessors)
Пример #9
0
 def test_sucesso(self):
     handler = Mock()
     home.index(handler)
     handler.assert_called_once_with('/templates/home.html')
Пример #10
0
 def test_sucesso(self):
     resposta_mock = Mock()
     crud.como_chegar(resposta_mock)
     resposta_mock.assert_called_once_with('/templates/como_chegar.html')
Пример #11
0
 def test_sucesso(self):
     resposta_mock = Mock()
     crud.foto(resposta_mock)
     resposta_mock.assert_called_once_with('/templates/foto.html')
Пример #12
0
 def test_aboutUs(self):
     resp_mock = Mock()
     about.index(resp_mock)
     resp_mock.assert_called_once_with('/templates/aboutus.html')
Пример #13
0
 def test_tickets(self):
     resp_mock = Mock()
     tickets.index(resp_mock)
     resp_mock.assert_called_once_with('/templates/ingressos.html')
Пример #14
0
 def test_sucesso(self):
     resposta_mock = Mock()
     crud.foto(resposta_mock)
     resposta_mock.assert_called_once_with('/templates/foto.html')
Пример #15
0
 def test_sucesso(self):
     resposta_mock = Mock()
     crud.como_chegar(resposta_mock)
     resposta_mock.assert_called_once_with('/templates/como_chegar.html')