Beispiel #1
0
 def _new_grp_p(self, description='', parent=None):
     """Create new persistent group."""
     grp = self._new_grp_t()
     get_db().add_group(grp)
     groups = get_db().retrieve_groups_by_name(grp.name)
     assert groups is not None
     assert len(groups) > 0
     return groups[0]
Beispiel #2
0
    def test_update_and_retrieve_by_key_picture(self):
        pic1 = self._new_pic_p()
        pic1.description = 'new text'

        get_db().update_picture(pic1)
        pic2 = get_db().retrieve_picture_by_key(pic1.key)

        assert pic2 is not None
        assert pic1.key == pic2.key
        assert pic1.path == pic2.path
Beispiel #3
0
    def test_add_and_retrieve_picture(self):
        pic1 = self._new_pic_t()
        assert pic1 is not None

        get_db().add_picture(pic1)
        pic2 = get_db().retrieve_picture_by_path(pic1.path)

        assert pic2 is not None
        assert pic2.key is not None
        assert pic1.path == pic2.path
Beispiel #4
0
 def test_add_and_retrieve_group(self):
     group1 = self._new_grp_t()
     assert group1 is not None
     get_db().add_group(group1)
     groups = get_db().retrieve_groups_by_name(group1.name)
     assert groups is not None
     assert len(groups) > 0
     group2 = groups[0]
     assert group2.key is not None
     assert group1.name == group2.name
     assert group1.parent == group2.parent
Beispiel #5
0
    def test_add_and_retrieve_by_name_tag(self):
        tag1 = self._new_tag_t()
        assert tag1 is not None

        get_db().add_tag(tag1)
        tag2 = get_db().retrieve_tag_by_name(tag1.name)

        assert tag2 is not None
        assert tag2.key is not None
        assert tag1.name == tag2.name
        assert tag1.parent == tag2.parent
Beispiel #6
0
 def test_update_and_retrieve_by_key_tag(self):
     tag1 = self._new_tag_p()
     tag1.description = 'new description'
     get_db().update_tag(tag1)
     tag2 = get_db().retrieve_tag_by_key(tag1.key)
     assert tag1.description == tag2.description
Beispiel #7
0
 def _new_pic_p(self, description=''):
     """Create new persistent picture."""
     pic = self._new_pic_t()
     get_db().add_picture(pic)
     return get_db().retrieve_picture_by_path(pic.path)
Beispiel #8
0
 def _new_tag_p(self, description='', parent=None):
     """Create new persistent tag."""
     tag = self._new_tag_t()
     get_db().add_tag(tag)
     return get_db().retrieve_tag_by_name(tag.name)
Beispiel #9
0
 def test_update_group(self):
     group1 = self._new_grp_p()
     group1.description = 'new text'
     get_db().update_group(group1)
     group2 = get_db().retrieve_group_by_key(group1.key)
     assert group1.description == group2.description