コード例 #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
ファイル: home_tests.py プロジェクト: brunovky/Repo-Scripts
 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
ファイル: rest_tests.py プロジェクト: brunovky/Repo-Scripts
 def test_vitrine(self):
     resposta_mock = Mock()
     crud.vitrine(resposta_mock)
     resposta_mock.assert_called_once_with('/templates/shop.html')
コード例 #7
0
ファイル: rest_tests.py プロジェクト: brunovky/Repo-Scripts
 def test_cadastrar_produto(self):
     resposta_mock = Mock()
     crud.cadastrar_produto(resposta_mock)
     resposta_mock.assert_called_once_with('/templates/add_product.html')
コード例 #8
0
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')