Пример #1
0
    def test_create_or_update_member(self):
        name = MEMBERS[0]['name']

        self.assertIsNone(db_api.load_member(name))

        created = db_api.create_or_update_member(
            name,
            MEMBERS[0]
        )

        self.assertIsNotNone(created)
        self.assertIsNotNone(created.name)

        updated = db_api.create_or_update_member(
            created.name,
            {'description': 'my new description'}
        )

        self.assertEqual('my new description', updated.description)
        self.assertEqual(
            'my new description',
            db_api.load_member(updated.name).description
        )

        fetched = db_api.get_member(created.name)

        self.assertEqual(updated, fetched)
    def test_create_and_get_and_load_member(self):
        created = db_api.create_member(MEMBERS[0])

        fetched = db_api.get_member(created["name"])

        self.assertEqual(created, fetched)

        fetched = db_api.load_member(created.name)

        self.assertEqual(created, fetched)

        self.assertIsNone(db_api.load_member("not-existing-wb"))
Пример #3
0
    def test_create_and_get_and_load_member(self):
        created = db_api.create_member(MEMBERS[0])

        fetched = db_api.get_member(created['name'])

        self.assertEqual(created, fetched)

        fetched = db_api.load_member(created.name)

        self.assertEqual(created, fetched)

        self.assertIsNone(db_api.load_member("not-existing-wb"))
    def test_create_or_update_member(self):
        name = MEMBERS[0]["name"]

        self.assertIsNone(db_api.load_member(name))

        created = db_api.create_or_update_member(name, MEMBERS[0])

        self.assertIsNotNone(created)
        self.assertIsNotNone(created.name)

        updated = db_api.create_or_update_member(created.name, {"description": "my new description"})

        self.assertEqual("my new description", updated.description)
        self.assertEqual("my new description", db_api.load_member(updated.name).description)

        fetched = db_api.get_member(created.name)

        self.assertEqual(updated, fetched)