Mercurial > malikania
view tests/libmlk-db/account/main.cpp @ 215:268b66d72ec0 default tip @
misc: remove Javascript bindings, closes #2402
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 10 Oct 2019 13:52:57 +0200 |
parents | 9ef01392a7f1 |
children |
line wrap: on
line source
/* * main.cpp -- test mlk::db::account * * Copyright (c) 2013-2018 David Demelier <markand@malikania.fr> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #define BOOST_TEST_MODULE "mlk::db::account" #include <boost/test/unit_test.hpp> #include <malikania/db/account.hpp> #include <malikania/db/test/db_fixture.hpp> namespace mlk::db { namespace { BOOST_FIXTURE_TEST_SUITE(account_suite, test::db_fixture) BOOST_AUTO_TEST_CASE(simple) { { account ac("markand", "plop"); ac.set_email("markand@malikania.fr"); ac.set_firstname("David"); ac.set_lastname("Demelier"); BOOST_TEST(ac.is_draft()); ac.publish(); BOOST_TEST(ac.is_published()); } const auto ac = account::find_by_login("markand"); BOOST_TEST(ac.has_value()); BOOST_TEST(ac->is_published()); BOOST_TEST(ac->get_email() == "markand@malikania.fr"); BOOST_TEST(ac->get_firstname() == "David"); BOOST_TEST(ac->get_lastname() == "Demelier"); } BOOST_AUTO_TEST_CASE(not_found) { const auto ac = account::find_by_login("notexist"); BOOST_TEST(!ac); } BOOST_AUTO_TEST_SUITE_END() } // !namespace } // !mlk